cf 0.9.1 → 0.11.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 (363) hide show
  1. package/README.md +20 -5
  2. package/dist/_meta/agent-context.json +46 -39
  3. package/dist/_meta/commands.json +9358 -10581
  4. package/dist/_meta/hand-written-commands.json +784 -0
  5. package/dist/_meta/schemas.json +14870 -14667
  6. package/dist/abuse-reports-sDBTV0qZ.mjs +8 -0
  7. package/dist/{access-CxyW_sIW.mjs → access-DcNzuCue.mjs} +1 -1
  8. package/dist/account-BX90zXn5.mjs +2 -0
  9. package/dist/account-tags-Bz3JG5hI.mjs +9 -0
  10. package/dist/accounts-DCuW3xyZ.mjs +28 -0
  11. package/dist/{acm-CHacxa3s.mjs → acm-zjfShZLS.mjs} +1 -1
  12. package/dist/{addressing-BnqNmmYN.mjs → addressing-DORQ64Ux.mjs} +11 -11
  13. package/dist/{agent-context-Bu6yvDqA.mjs → agent-context-BgPR_aQr.mjs} +1 -1
  14. package/dist/agent-memory-C0hAUMeC.mjs +6 -0
  15. package/dist/ai-BpEBGMT2.mjs +5 -0
  16. package/dist/ai-audit-DnU3vn3E.mjs +2 -0
  17. package/dist/ai-gateway-COOrr_Yw.mjs +13 -0
  18. package/dist/ai-search-DKbN9Tyd.mjs +7 -0
  19. package/dist/ai-security-C_I5lo58.mjs +4 -0
  20. package/dist/{alerting-qa8SkXlD.mjs → alerting-4T8gmZs-.mjs} +4 -4
  21. package/dist/analytics-Bxh4TCP7.mjs +3 -0
  22. package/dist/analytics_engine-fV56bjVN.mjs +2 -0
  23. package/dist/{api-security-MfHbfZyf.mjs → api-security-COk_i184.mjs} +20 -20
  24. package/dist/argo-DIRfvxvv.mjs +2 -0
  25. package/dist/args-DlUhyGU0.mjs +2 -0
  26. package/dist/artifacts-BBfXNfUg.mjs +4 -0
  27. package/dist/audit-logs-BlOrlAWe.mjs +2 -0
  28. package/dist/{auth-DuLchM18.mjs → auth-D3X9HYhD.mjs} +3 -3
  29. package/dist/auth-DPhNN3Ly.mjs +5 -0
  30. package/dist/billing-B9e4PnvN.mjs +3 -0
  31. package/dist/body-parser-BshbixEq.mjs +2 -0
  32. package/dist/bot-management-D2JVeS-V.mjs +5 -0
  33. package/dist/botnet-feed-BTzTYs5d.mjs +3 -0
  34. package/dist/brand-protection-C5Q6Gpw9.mjs +3 -0
  35. package/dist/{browser-extension-q79xHrVW.mjs → browser-extension-u5uA0Lwk.mjs} +1 -1
  36. package/dist/browser-run-CHGOCTdG.mjs +4 -0
  37. package/dist/build-D0FhOj40.mjs +8 -0
  38. package/dist/{cache-Cl7vKJwH.mjs → cache-C6V7PbQM.mjs} +1 -1
  39. package/dist/{calls-DtK_ANxq.mjs → calls-Bye8Tyy-.mjs} +1 -1
  40. package/dist/certificate-authorities-B-U_e6JJ.mjs +2 -0
  41. package/dist/cf-Ds4JFovl.mjs +18 -0
  42. package/dist/chunk-LQW53VED-22IYZovK.mjs +119 -0
  43. package/dist/chunk-QBZBEHZB-CKzQKcIp.mjs +2 -0
  44. package/dist/{client-certificates-BtPU9GsQ.mjs → client-certificates-3RrC-6LG.mjs} +1 -1
  45. package/dist/{client-side-security-DAn-3jwp.mjs → client-side-security-DIdKvRMT.mjs} +1 -1
  46. package/dist/cloud-connector-CL1jPQud.mjs +2 -0
  47. package/dist/cloudforce-one-DULeqLkR.mjs +36 -0
  48. package/dist/command-C9VP3xaA.mjs +2 -0
  49. package/dist/{completions-BHE4pRjB.mjs → completions-CqgGKRAC.mjs} +3 -3
  50. package/dist/config.d.mts +1460 -1348
  51. package/dist/config.mjs +1 -1
  52. package/dist/connector-interrupts-CXlLObDv.mjs +2 -0
  53. package/dist/connector-telemetry-events-BrYX4ig4.mjs +2 -0
  54. package/dist/connector-telemetry-events-latest-BbpcII3_.mjs +2 -0
  55. package/dist/connector-telemetry-snapshots-BdeBQYcM.mjs +2 -0
  56. package/dist/connector-telemetry-snapshots-latest-DuCiimXl.mjs +2 -0
  57. package/dist/{connectors-Bo6ZT8PT.mjs → connectors-BQwyBJ4_.mjs} +1 -1
  58. package/dist/containers-BrQtGiNp.mjs +58 -0
  59. package/dist/{content-scan-D03UfK2X.mjs → content-scan-DNzhXYkY.mjs} +1 -1
  60. package/dist/{csamScanner-DgS-7ADh.mjs → csamScanner-CFq5s1Q3.mjs} +1 -1
  61. package/dist/{ct-alerting-8AKtNnUg.mjs → ct-alerting-CH6UmsGQ.mjs} +1 -1
  62. package/dist/custom-certificates-DnG73Wg2.mjs +5 -0
  63. package/dist/custom-csrs-bhClr2SU.mjs +3 -0
  64. package/dist/custom-hostnames-C0eiGvG9.mjs +5 -0
  65. package/dist/custom-nameservers-CVMhhLm6.mjs +3 -0
  66. package/dist/custom-pages-DTINMR30.mjs +3 -0
  67. package/dist/d1-sKdExJYF.mjs +20 -0
  68. package/dist/data-security-mV3a6UfW.mjs +7 -0
  69. package/dist/dcv-delegation-dBu3jdRw.mjs +2 -0
  70. package/dist/delegate.mjs +1 -1
  71. package/dist/{deploy-DGlmjPTS.mjs → deploy-BL59O1O1.mjs} +1 -1
  72. package/dist/deploy-input-Dz6q-__n.mjs +2 -0
  73. package/dist/{dev-BbLV0Ti-.mjs → dev-BDaavgH1.mjs} +2 -2
  74. package/dist/diagnostics-CJV6qWUA.mjs +3 -0
  75. package/dist/{directory-CCndFkbQ.mjs → directory-B5zCMusW.mjs} +1 -1
  76. package/dist/{dispatch-namespaces-C48JQ9EA.mjs → dispatch-namespaces-Dg5lu5xX.mjs} +1 -1
  77. package/dist/dist-BHi7UhXO.mjs +72 -0
  78. package/dist/dist-BWpErtDM.mjs +384 -0
  79. package/dist/{dls-BBq99pjI.mjs → dls-t0hnIe_P.mjs} +1 -1
  80. package/dist/dns-C8FC2hbh.mjs +29 -0
  81. package/dist/{dns-firewall-DdwVtm12.mjs → dns-firewall-CuhhUm55.mjs} +1 -1
  82. package/dist/{dot-prop-6SRZBKHT-C_xd7eTS.mjs → dot-prop-6SRZBKHT-wwGHcwAa.mjs} +1 -1
  83. package/dist/dry-run-DL2V6yFm.mjs +2 -0
  84. package/dist/durable-objects-BLrgM3Cw.mjs +2 -0
  85. package/dist/email-auth-BmYrl0pO.mjs +2 -0
  86. package/dist/email-routing-CF3_Z957.mjs +6 -0
  87. package/dist/email-security-F7OYcMkZ.mjs +18 -0
  88. package/dist/email-sending-EyU3WvGQ.mjs +7 -0
  89. package/dist/fieldExtractors-Cno37T2m.mjs +3 -0
  90. package/dist/firewall-8YWWy4iB.mjs +11 -0
  91. package/dist/flagship-C4x0l-8J.mjs +4 -0
  92. package/dist/{fraud-AH47n-wL.mjs → fraud-HR_SdUx3.mjs} +1 -1
  93. package/dist/google-tag-gateway-BdcS0WnX.mjs +2 -0
  94. package/dist/{healthchecks-DfEUG007.mjs → healthchecks-4qOvjrTN.mjs} +2 -2
  95. package/dist/{hostnames-DQUiD3Vr.mjs → hostnames-DehdYOMz.mjs} +1 -1
  96. package/dist/{hyperdrive-RyQboMWI.mjs → hyperdrive-3gD3hn70.mjs} +1 -1
  97. package/dist/iam-DR72hmii.mjs +6 -0
  98. package/dist/images-CeKc5JPh.mjs +8 -0
  99. package/dist/index.mjs +1 -1
  100. package/dist/intel-DtFix9WL.mjs +8 -0
  101. package/dist/{interactive-mV8PABm6.mjs → interactive-C7M55Wxx.mjs} +1 -1
  102. package/dist/ips-CtWCjXAN.mjs +2 -0
  103. package/dist/{keyless-certificates-oNu5jWKF.mjs → keyless-certificates-Dk24yQFz.mjs} +1 -1
  104. package/dist/keys-BmhG6Kn1.mjs +2 -0
  105. package/dist/{kv-Bi9B4E0A.mjs → kv-BuVPAuZP.mjs} +1 -1
  106. package/dist/{leaked-credential-checks-DKRjBLcr.mjs → leaked-credential-checks-XcZmt1I-.mjs} +1 -1
  107. package/dist/load-balancers-CylN-l7n.mjs +6 -0
  108. package/dist/{local-DTyuGwTw.mjs → local-Be3lg_9E.mjs} +1 -1
  109. package/dist/{local-runtime-IAXhEugU.mjs → local-runtime-Ce7k598H.mjs} +1 -1
  110. package/dist/logexplorer-CvRPoKbj.mjs +17 -0
  111. package/dist/logo-matches-Heuft3yF.mjs +2 -0
  112. package/dist/logos-DRYjGBDq.mjs +3 -0
  113. package/dist/logpush-Dve9jOMp.mjs +4 -0
  114. package/dist/{logs-DmWWL5f9.mjs → logs-SC86FE89.mjs} +1 -1
  115. package/dist/{magic-cloud-networking-XbTa6P52.mjs → magic-cloud-networking-DXzeqwX-.mjs} +4 -4
  116. package/dist/magic-network-monitoring-DW0Jl74i.mjs +4 -0
  117. package/dist/magic-transit-BK_3asH2.mjs +111 -0
  118. package/dist/managed-transforms-B6TV4qoE.mjs +3 -0
  119. package/dist/matches-Iss9Fo4R.mjs +2 -0
  120. package/dist/mcp-8wxXT6JU.mjs +4 -0
  121. package/dist/mesh-Bf9UAS4J.mjs +4 -0
  122. package/dist/{moq-CJpE-eNj.mjs → moq-ZKMFOeVz.mjs} +1 -1
  123. package/dist/mtls-certificates-DoWm6GiE.mjs +3 -0
  124. package/dist/{network-D2WRXCDe.mjs → network-B1lBARU9.mjs} +1 -1
  125. package/dist/{network-interconnects-Clq4X1U8.mjs → network-interconnects-CLYIFHfU.mjs} +1 -1
  126. package/dist/oauth-DuEONNgC.mjs +14 -0
  127. package/dist/{oauth-clients-hilWfAlm.mjs → oauth-clients-DgiTzLzu.mjs} +1 -1
  128. package/dist/oauth-scopes-BOBRMxjm.mjs +2 -0
  129. package/dist/observability-Jya7-zkl.mjs +4 -0
  130. package/dist/{open-PBXRGS4R-C46yIm3u.mjs → open-PBXRGS4R-CX8K4WYl.mjs} +3 -3
  131. package/dist/{organization-D41rIvJa.mjs → organization-CYxYV4e0.mjs} +6 -6
  132. package/dist/organizations-SacGUW44.mjs +2 -0
  133. package/dist/origin-ca-certificates-Ph1bJGQ1.mjs +3 -0
  134. package/dist/origin-post-quantum-encryption-BBLiGAGB.mjs +2 -0
  135. package/dist/origin-tls-client-auth-DSDgTN2X.mjs +4 -0
  136. package/dist/{output-DgW1hQGX.mjs → output-Ccqw2WOb.mjs} +1 -1
  137. package/dist/page-rules-BqEyFR2c.mjs +27 -0
  138. package/dist/pages-CQ7ZVWk1.mjs +14 -0
  139. package/dist/pay-per-crawl-BMe_3_Qj.mjs +4 -0
  140. package/dist/pipelines-6De2Pe2C.mjs +6 -0
  141. package/dist/precursor-iwK-1P_d.mjs +4 -0
  142. package/dist/progress-BqQcF5QH.mjs +2 -0
  143. package/dist/project-settings-C_1-JI6Y.mjs +3 -0
  144. package/dist/prompt-B0sWIs9c.mjs +3 -0
  145. package/dist/{public-BwQqexwo-DbWj8rrr.mjs → public-BYCVISMH-DnMJ5Jct.mjs} +1 -1
  146. package/dist/queries-c7zvnfEQ.mjs +3 -0
  147. package/dist/queues-BU6y16qS.mjs +6 -0
  148. package/dist/r2-Jo3QMahK.mjs +24 -0
  149. package/dist/{r2-data-catalog-DLtf9d6o.mjs → r2-data-catalog-B-tw-JdG.mjs} +1 -1
  150. package/dist/radar-DIYAMEof.mjs +2 -0
  151. package/dist/{rate-limits-B1YjnGue.mjs → rate-limits-DewOcznT.mjs} +1 -1
  152. package/dist/raw-fetch-Cc-MjHeL.mjs +2 -0
  153. package/dist/realtimekit-cnZEVNDn.mjs +7 -0
  154. package/dist/registrar-BsWr_aPM.mjs +23 -0
  155. package/dist/{registrar-sandbox-0i1T3zne.mjs → registrar-sandbox-BlcpUyIH.mjs} +6 -6
  156. package/dist/{registry-DDcSvd8H.mjs → registry-jifR3_Y6.mjs} +1 -1
  157. package/dist/reporting--1AyTV7k.mjs +2 -0
  158. package/dist/request-tracers-C_VX7X6-.mjs +2 -0
  159. package/dist/{resource-sharing-Ctdi9D-j.mjs → resource-sharing-Br5dqr3o.mjs} +1 -1
  160. package/dist/resource-tagging-C33U6T74.mjs +2 -0
  161. package/dist/rules-BfjzALMi.mjs +4 -0
  162. package/dist/rulesets-3i_1Vwt-.mjs +5 -0
  163. package/dist/rum-CjmIckiR.mjs +4 -0
  164. package/dist/{schema-BeXPWeK9.mjs → schema-1mwmslUV.mjs} +1 -1
  165. package/dist/schema-flags-llLJuFFw.mjs +5 -0
  166. package/dist/{scim-BgGsmHrL.mjs → scim-pApmzA5B.mjs} +1 -1
  167. package/dist/sdk-ZctLa5jW.mjs +3 -0
  168. package/dist/{secrets-store-BCpFhYFv.mjs → secrets-store-DBC9WJau.mjs} +1 -1
  169. package/dist/security-center-Djm06dq-.mjs +2 -0
  170. package/dist/{security-txt-Be2Bif0z.mjs → security-txt-Ci7bP4zH.mjs} +1 -1
  171. package/dist/{share-Bz2tFTUP.mjs → share-Dj-MNXrw.mjs} +4 -4
  172. package/dist/shared-BJvq4DkR.mjs +290 -0
  173. package/dist/smart-shield--8EpJjrF.mjs +4 -0
  174. package/dist/snippets-Dyz0PH60.mjs +4 -0
  175. package/dist/{spawn-CHkoow5W.mjs → spawn-C5Z7oWdp.mjs} +108 -112
  176. package/dist/{spectrum-BA0a42eM.mjs → spectrum-rAHWz8rH.mjs} +1 -1
  177. package/dist/{speed-mmOjxOzo.mjs → speed-BKepWBXj.mjs} +1 -1
  178. package/dist/src-gJma71Ec.mjs +108 -0
  179. package/dist/{ssl-Yr6kELqg.mjs → ssl-KdFiY3ev.mjs} +1 -1
  180. package/dist/startup-profile-GLNPHQ9U.mjs +17 -0
  181. package/dist/{state-DZC531l2.mjs → state-Cu3cItUg.mjs} +1 -1
  182. package/dist/{stream-Cu0kYWbc.mjs → stream-CKJ6Tb0M.mjs} +13 -13
  183. package/dist/submit-BxbKKhBn.mjs +2 -0
  184. package/dist/tags-DA8dq9fx.mjs +2 -0
  185. package/dist/tenant-DLXw48hS.mjs +2 -0
  186. package/dist/tenant-custom-nameservers-9G93XuvU.mjs +3 -0
  187. package/dist/{tools-D2Xxfkrc.mjs → tools-x8bj9E6b.mjs} +1 -1
  188. package/dist/{tunnel-CDYkWjnt.mjs → tunnel-CNQA5Flp.mjs} +1 -1
  189. package/dist/tunnels-CC10EOsU.mjs +2 -0
  190. package/dist/turnstile-CH58hnf4.mjs +23 -0
  191. package/dist/{ui-DIpjthrV.mjs → ui-CmnnBm_O.mjs} +1 -1
  192. package/dist/url-info-BpCgdUtL.mjs +2 -0
  193. package/dist/{url-normalization-BeKkOZz7.mjs → url-normalization-BzuynEy1.mjs} +1 -1
  194. package/dist/url-scanner-APIZbhB7.mjs +2 -0
  195. package/dist/user-2-NGebfI.mjs +12 -0
  196. package/dist/values-S_bNv819.mjs +2 -0
  197. package/dist/{vectorize-CjXfiFH4.mjs → vectorize-Bv7feLBC.mjs} +1 -1
  198. package/dist/waiting-rooms-Dk4LIpvm.mjs +11 -0
  199. package/dist/{web-assets-BzM5vVzy.mjs → web-assets-C1UmOyzD.mjs} +1 -1
  200. package/dist/web3-GnUocVYH.mjs +4 -0
  201. package/dist/workers-J1-PLwdl.mjs +28 -0
  202. package/dist/{workers-builds-B44wc67O.mjs → workers-builds-DCHmWOMS.mjs} +4 -4
  203. package/dist/{workflows-rFuQWClt.mjs → workflows-CArfEI2c.mjs} +2 -2
  204. package/dist/zaraz-mg2YlR3_.mjs +2 -0
  205. package/dist/zero-trust-DVdUPtj1.mjs +93 -0
  206. package/dist/zone-DMAfrDJX.mjs +2 -0
  207. package/dist/zones-CNwxUi7I.mjs +21 -0
  208. package/package.json +10 -7
  209. package/dist/abuse-reports-CzDAjFpo.mjs +0 -8
  210. package/dist/account-Dd4-tDYJ.mjs +0 -2
  211. package/dist/account-tags-65fAlHrf.mjs +0 -9
  212. package/dist/accounts-Bp5KGc6r.mjs +0 -28
  213. package/dist/agent-memory-D--BQS0W.mjs +0 -6
  214. package/dist/ai-BnVlQDiI.mjs +0 -5
  215. package/dist/ai-audit-CfpDKXkD.mjs +0 -2
  216. package/dist/ai-gateway-oG4j_oYN.mjs +0 -13
  217. package/dist/ai-search-B2l3B_jn.mjs +0 -7
  218. package/dist/ai-security-byjIIrfl.mjs +0 -4
  219. package/dist/analytics-DeIKjC9n.mjs +0 -3
  220. package/dist/analytics_engine-BnECMIWJ.mjs +0 -2
  221. package/dist/argo-DFerMyXF.mjs +0 -2
  222. package/dist/artifacts-CtyEYYDa.mjs +0 -4
  223. package/dist/audit-logs-retFtvow.mjs +0 -2
  224. package/dist/auth-aazs91XL.mjs +0 -5
  225. package/dist/billing-CxQVqpGZ.mjs +0 -3
  226. package/dist/body-parser-CYD7PKFC.mjs +0 -2
  227. package/dist/bot-management-Rli7v7tg.mjs +0 -5
  228. package/dist/botnet-feed-Cw6XSEf8.mjs +0 -3
  229. package/dist/brand-protection-CTvnHGfV.mjs +0 -3
  230. package/dist/browser-run-FwtwnBzA.mjs +0 -4
  231. package/dist/build-Dji9BYmV.mjs +0 -2
  232. package/dist/certificate-authorities-DZP1RzAs.mjs +0 -2
  233. package/dist/cf-oSz9pud_.mjs +0 -18
  234. package/dist/chunk-LQW53VED-Xakf_rUn.mjs +0 -499
  235. package/dist/cloud-connector-BpVcvhjZ.mjs +0 -2
  236. package/dist/cloudforce-one-2PecncfX.mjs +0 -30
  237. package/dist/connector-interrupts-ollUcksZ.mjs +0 -2
  238. package/dist/connector-telemetry-events-D5_3X7XW.mjs +0 -2
  239. package/dist/connector-telemetry-snapshots-CJ9gLRFR.mjs +0 -2
  240. package/dist/containers-Bog7j0Hw.mjs +0 -54
  241. package/dist/custom-certificates-4y35UC1X.mjs +0 -5
  242. package/dist/custom-csrs-DwBrLh-H.mjs +0 -4
  243. package/dist/custom-hostnames-CDIAnsRa.mjs +0 -5
  244. package/dist/custom-nameservers-stk7ymnP.mjs +0 -3
  245. package/dist/custom-pages-vfDxrXbt.mjs +0 -4
  246. package/dist/d1-Cllm-iTT.mjs +0 -20
  247. package/dist/data-security-rnoSCEdL.mjs +0 -7
  248. package/dist/dcv-delegation-DCRCOL6l.mjs +0 -2
  249. package/dist/deploy-input-DhCo1I0I.mjs +0 -242
  250. package/dist/diagnostics-D5Yo2xqx.mjs +0 -3
  251. package/dist/dist-COfwjT96.mjs +0 -72
  252. package/dist/dns-DdQYtenF.mjs +0 -29
  253. package/dist/durable-objects-BvxXBht_.mjs +0 -2
  254. package/dist/email-CGOC_evd.mjs +0 -2
  255. package/dist/email-auth-DFvXKSkg.mjs +0 -2
  256. package/dist/email-routing-QBRPBlyl.mjs +0 -6
  257. package/dist/email-security-BFagcRPP.mjs +0 -18
  258. package/dist/email-sending-Ddhe7xjN.mjs +0 -7
  259. package/dist/filters-CGisPGD1.mjs +0 -4
  260. package/dist/firewall-DD8U-Brd.mjs +0 -11
  261. package/dist/flagship-FJHc4mFi.mjs +0 -4
  262. package/dist/google-tag-gateway-149kbuG_.mjs +0 -2
  263. package/dist/iam-BhHYhMXO.mjs +0 -6
  264. package/dist/images-CDViyKtZ.mjs +0 -8
  265. package/dist/intel-YHZbPlS3.mjs +0 -8
  266. package/dist/ips-BpCdldFx.mjs +0 -2
  267. package/dist/keys-yYtv7Ztr.mjs +0 -2
  268. package/dist/load-balancers-jRCN75mX.mjs +0 -7
  269. package/dist/logexplorer-kO8CULiK.mjs +0 -24
  270. package/dist/logo-matches-LyDAYPbI.mjs +0 -2
  271. package/dist/logos-O9f5bGSB.mjs +0 -3
  272. package/dist/logpush-dtXLu3Ck.mjs +0 -5
  273. package/dist/magic-network-monitoring-CpfkgZMp.mjs +0 -4
  274. package/dist/magic-transit-DwgZeIj-.mjs +0 -111
  275. package/dist/managed-transforms-DCmogkxv.mjs +0 -3
  276. package/dist/matches-BAeN8VM1.mjs +0 -2
  277. package/dist/mcp-DKZ2D050.mjs +0 -4
  278. package/dist/media-CnxgOViL.mjs +0 -2
  279. package/dist/mesh-CzIPtuaM.mjs +0 -4
  280. package/dist/mtls-certificates-Bbm_1lQI.mjs +0 -3
  281. package/dist/oauth-BPizUUqP.mjs +0 -15
  282. package/dist/oauth-scopes-CmbgsPYd.mjs +0 -2
  283. package/dist/observability-DXYgDdU5.mjs +0 -4
  284. package/dist/organizations-eNzfOwlP.mjs +0 -2
  285. package/dist/origin-ca-certificates-DaiAmw45.mjs +0 -3
  286. package/dist/origin-post-quantum-encryption-7YztBged.mjs +0 -2
  287. package/dist/origin-tls-client-auth-DRwURM8s.mjs +0 -4
  288. package/dist/page-rules-B2Csdc4h.mjs +0 -18
  289. package/dist/pages-BAL6Q7OY.mjs +0 -14
  290. package/dist/pay-per-crawl-C-1-ZAtn.mjs +0 -4
  291. package/dist/pipelines-cyQOuFLb.mjs +0 -6
  292. package/dist/precursor-BrweY39h.mjs +0 -4
  293. package/dist/progress-B84wYh91.mjs +0 -2
  294. package/dist/prompt-CDtLWxNv.mjs +0 -3
  295. package/dist/queries-oM8uGZy5.mjs +0 -3
  296. package/dist/queues-CTx04ZNw.mjs +0 -6
  297. package/dist/r2-CnlIUn7R.mjs +0 -24
  298. package/dist/radar-CGNgGh8v.mjs +0 -2
  299. package/dist/raw-fetch-Dz-QBoP_.mjs +0 -2
  300. package/dist/realtimekit-BPwzhNS9.mjs +0 -7
  301. package/dist/registrar-BEcb90RX.mjs +0 -21
  302. package/dist/reporting-CLbjHlnw.mjs +0 -2
  303. package/dist/request-tracers-BcKpofP1.mjs +0 -2
  304. package/dist/resource-tagging-DGEyVTDN.mjs +0 -2
  305. package/dist/rules-CmuB5rIN.mjs +0 -4
  306. package/dist/rulesets-CGaMq8vG.mjs +0 -8
  307. package/dist/rum-QT6EP4JK.mjs +0 -4
  308. package/dist/schema-flags-DHryz6SF.mjs +0 -5
  309. package/dist/sdk-m4xeaua4.mjs +0 -3
  310. package/dist/security-center-BNm4uPVB.mjs +0 -2
  311. package/dist/session-Ckt20hHa.mjs +0 -2
  312. package/dist/shared-BzPQog8H.mjs +0 -2
  313. package/dist/smart-shield-SODkOUyO.mjs +0 -4
  314. package/dist/snippets-B5jY8v_7.mjs +0 -4
  315. package/dist/src-CHW7s5IS.mjs +0 -108
  316. package/dist/submit-Dl_27e0n.mjs +0 -2
  317. package/dist/tags-Cdo_Pwtr.mjs +0 -2
  318. package/dist/tenant-EX-ANl6X.mjs +0 -2
  319. package/dist/tenant-custom-nameservers-BPHUeckw.mjs +0 -3
  320. package/dist/triggers-Bf9hbP3h.mjs +0 -2
  321. package/dist/tunnels-CgyX8R2J.mjs +0 -2
  322. package/dist/turnstile-BUtzlW-0.mjs +0 -23
  323. package/dist/url-info-CJsa1Oc9.mjs +0 -2
  324. package/dist/url-scanner-Cz-yl0_3.mjs +0 -2
  325. package/dist/user-BxHjEqpd.mjs +0 -12
  326. package/dist/values-C43NurfT.mjs +0 -2
  327. package/dist/versions-BFbc90Wu.mjs +0 -2
  328. package/dist/waiting-rooms-C5jSQv_r.mjs +0 -11
  329. package/dist/web3-Ctv9HGiR.mjs +0 -4
  330. package/dist/workers-D-YbIedB.mjs +0 -24
  331. package/dist/zaraz-BA6kY-b6.mjs +0 -2
  332. package/dist/zero-trust-DOFLlUz1.mjs +0 -102
  333. package/dist/zone-B_rgejLV.mjs +0 -2
  334. package/dist/zone-tags-BWdza4rH.mjs +0 -9
  335. package/dist/zones-DTWO7Vvn.mjs +0 -21
  336. /package/dist/{Page-C-JHZnIy.mjs → Page-9ry_XAVC.mjs} +0 -0
  337. /package/dist/{alerts-B85uj2Vx.mjs → alerts-15-IW4jE.mjs} +0 -0
  338. /package/dist/{autorag-Do9l_LyY.mjs → autorag-CFwRkEKw.mjs} +0 -0
  339. /package/dist/{brands-DateHCdd.mjs → brands-BgT1vu9B.mjs} +0 -0
  340. /package/dist/{chunk-6EUZQHAF-l8tR2Qyj.mjs → chunk-6EUZQHAF-C3w62dek.mjs} +0 -0
  341. /package/dist/{chunk-Q72B4Q5Z-CPy_WJKU.mjs → chunk-Q72B4Q5Z-DVMMVVEs.mjs} +0 -0
  342. /package/dist/{clear-CB2kgcEB.mjs → clear-BlCK85Me.mjs} +0 -0
  343. /package/dist/{cli-types-BWdZbsFE.mjs → cli-types-DAYeL_Mj.mjs} +0 -0
  344. /package/dist/{domain-info-DJHEt8JJ.mjs → domain-info-C7LBxPBt.mjs} +0 -0
  345. /package/dist/{health-buY5f5pp.mjs → health-DZFfafkX.mjs} +0 -0
  346. /package/dist/{input-validation-BBKJRoRB.mjs → input-validation-QDIYu7Vb.mjs} +0 -0
  347. /package/dist/{internal-CwyoJUHh.mjs → internal-BKHC2D1Y.mjs} +0 -0
  348. /package/dist/{live-wEpA5V_n.mjs → live-DwCvDmaH.mjs} +0 -0
  349. /package/dist/{metadata-8AkOftcB.mjs → metadata-B5yfL0ln.mjs} +0 -0
  350. /package/dist/{rate-limit-analytics-Bf1uT0lT.mjs → rate-limit-analytics-B8Vuu1sU.mjs} +0 -0
  351. /package/dist/{ready-CBSCPiHE.mjs → ready-D9H2zHHI.mjs} +0 -0
  352. /package/dist/{recent-submissions-Dpmq1f7z.mjs → recent-submissions-BPo0J80d.mjs} +0 -0
  353. /package/dist/{refute-u7ZPQJZy.mjs → refute-2W8NLCN4.mjs} +0 -0
  354. /package/dist/{resolve-XgxRJ-Ys.mjs → resolve-B8CyM1mi.mjs} +0 -0
  355. /package/dist/{scan-logo-Ba8WZAyp.mjs → scan-logo-D5x6F1Y0.mjs} +0 -0
  356. /package/dist/{scan-page-Bcq3Ei86.mjs → scan-page-CWhta3x7.mjs} +0 -0
  357. /package/dist/{search-D9WDwnV4.mjs → search-DZmBQJL9.mjs} +0 -0
  358. /package/dist/{signed-url-CjPbG5zV.mjs → signed-url-CQrmWgz5.mjs} +0 -0
  359. /package/dist/{submission-info-Z9hhp9Rq.mjs → submission-info-C98A0bqq.mjs} +0 -0
  360. /package/dist/{theme-BePJemMn.mjs → theme-CrIBazAF.mjs} +0 -0
  361. /package/dist/{total-queries-aKAYX1iX.mjs → total-queries-BZoaFoDE.mjs} +0 -0
  362. /package/dist/{tracked-domains-Ck7Jm4Kn.mjs → tracked-domains-CNHogPHx.mjs} +0 -0
  363. /package/dist/{verify-2yi0H93r.mjs → verify-4e4L9IRk.mjs} +0 -0
@@ -1,111 +0,0 @@
1
- #!/usr/bin/env node
2
- import{t as e}from"./local-DTyuGwTw.mjs";import{f as t,g as n}from"./oauth-BPizUUqP.mjs";import{a as r,r as i}from"./auth-DuLchM18.mjs";import{t as a}from"./output-DgW1hQGX.mjs";import{n as o,t as s}from"./progress-B84wYh91.mjs";import{n as c,r as l,t as u}from"./body-parser-CYD7PKFC.mjs";import{n as d}from"./input-validation-BBKJRoRB.mjs";import{a as f,i as p,n as m}from"./prompt-CDtLWxNv.mjs";import{n as h,t as g}from"./raw-fetch-Dz-QBoP_.mjs";function _(e){return e.option(`block-any-queries`,{type:`boolean`,description:`Whether to block DNS ANY queries. Optional. Defaults to true.`}).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 r=>{if(r.dryRun){o({command:`cf magic-transit advanced-dns-protection configs dns protection rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_dns_protection/configs/dns_protection/rules`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({block_any_queries:r[`block-any-queries`],burst_sensitivity:d(r[`burst-sensitivity`],`burst-sensitivity`,`text`),mode:d(r.mode,`mode`,`text`),name:d(r.name,`name`,`text`),profile_sensitivity:d(r[`profile-sensitivity`],`profile-sensitivity`,`text`),rate_sensitivity:d(r[`rate-sensitivity`],`rate-sensitivity`,`text`),scope:d(r.scope,`scope`,`text`)}):c(r.body)});return}let l=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.magicTransit.advancedDnsProtection.configs.dns.protection.rules.create({...e,account_id:p})),{successLabel:`Created`});return}r[`burst-sensitivity`]===void 0&&(r[`burst-sensitivity`]=await f(`burst-sensitivity`,`The burst sensitivity. Must be one of 'low', 'medium', 'high'.`)),r.mode===void 0&&(r.mode=await f(`mode`,`The mode for DNS Protection. Must be one of 'enabled', 'disabled', 'monitoring'.`)),r.name===void 0&&(r.name=await f(`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'.`)),r[`profile-sensitivity`]===void 0&&(r[`profile-sensitivity`]=await f(`profile-sensitivity`,`The profile sensitivity. Recommended setting is 'low'. Must be one of 'low', 'medium', 'high', or 'very_high'.`)),r[`rate-sensitivity`]===void 0&&(r[`rate-sensitivity`]=await f(`rate-sensitivity`,`The rate sensitivity. Must be one of 'low', 'medium', 'high'.`)),r.scope===void 0&&(r.scope=await f(`scope`,`The scope for the DNS Protection rule. Must be one of 'global', 'region', or 'datacenter'.`));let m=u({block_any_queries:r[`block-any-queries`],burst_sensitivity:d(r[`burst-sensitivity`],`burst-sensitivity`,`text`),mode:d(r.mode,`mode`,`text`),name:d(r.name,`name`,`text`),profile_sensitivity:d(r[`profile-sensitivity`],`profile-sensitivity`,`text`),rate_sensitivity:d(r[`rate-sensitivity`],`rate-sensitivity`,`text`),scope:d(r.scope,`scope`,`text`)});a(await s(`Creating`,async()=>l.magicTransit.advancedDnsProtection.configs.dns.protection.rules.create({...m,account_id:p})),{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 r=>{if(r.dryRun){o({command:`cf magic-transit advanced-dns-protection configs dns protection rules delete for account`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_dns_protection/configs/dns_protection/rules`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
3
- `);return}a(await s(`Deleting`,async()=>c.magicTransit.advancedDnsProtection.configs.dns.protection.rules.delete.for.account({account_id:l})),{successLabel:`Deleted`})}},y={command:`for`,describe:`Operations for advanced-dns-protection.configs.dns.protection.rules.delete.for`,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 r=>{if(r.dryRun){o({command:`cf magic-transit advanced-dns-protection configs dns protection rules delete protection rule`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_dns_protection/configs/dns_protection/rules/${r[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(r[`rule-id`]))}`,pathParams:{"rule-id":String(r[`rule-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
4
- `);return}a(await s(`Deleting`,async()=>c.magicTransit.advancedDnsProtection.configs.dns.protection.rules.delete.protection.rule({account_id:l,rule_id:r[`rule-id`]})),{successLabel:`Deleted`})}},S={command:`protection`,describe:`Operations for advanced-dns-protection.configs.dns.protection.rules.delete.protection`,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 r=>{if(r.dryRun){o({command:`cf magic-transit advanced-dns-protection configs dns protection rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_dns_protection/configs/dns_protection/rules/${r[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(r[`rule-id`]))}`,pathParams:{"rule-id":String(r[`rule-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.magicTransit.advancedDnsProtection.configs.dns.protection.rules.get({account_id:l,rule_id:r[`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 r=>{let c={page:r.page,per_page:r[`per-page`],order:r.order,direction:r.direction};if(r.dryRun){o({command:`cf magic-transit advanced-dns-protection configs dns protection rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_dns_protection/configs/dns_protection/rules`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.magicTransit.advancedDnsProtection.configs.dns.protection.rules.list({account_id:u,...c})),{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(`block-any-queries`,{type:`boolean`,description:`The new value for whether to block DNS ANY queries. Optional.`}).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 r=>{if(r.dryRun){o({command:`cf magic-transit advanced-dns-protection configs dns protection rules update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_dns_protection/configs/dns_protection/rules/${r[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(r[`rule-id`]))}`,pathParams:{"rule-id":String(r[`rule-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({block_any_queries:r[`block-any-queries`],burst_sensitivity:d(r[`burst-sensitivity`],`burst-sensitivity`,`text`),mode:d(r.mode,`mode`,`text`),profile_sensitivity:d(r[`profile-sensitivity`],`profile-sensitivity`,`text`),rate_sensitivity:d(r[`rate-sensitivity`],`rate-sensitivity`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.magicTransit.advancedDnsProtection.configs.dns.protection.rules.update({...e,account_id:f,rule_id:r[`rule-id`]})),{successLabel:`Updated`});return}let p=u({block_any_queries:r[`block-any-queries`],burst_sensitivity:d(r[`burst-sensitivity`],`burst-sensitivity`,`text`),mode:d(r.mode,`mode`,`text`),profile_sensitivity:d(r[`profile-sensitivity`],`profile-sensitivity`,`text`),rate_sensitivity:d(r[`rate-sensitivity`],`rate-sensitivity`,`text`)});a(await s(`Updating`,async()=>l.magicTransit.advancedDnsProtection.configs.dns.protection.rules.update({...p,account_id:f,rule_id:r[`rule-id`]})),{successLabel:`Updated`})}},A={command:`rules`,describe:`Operations for advanced-dns-protection.configs.dns.protection.rules`,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:`Advanced Dns Protection operations`,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 r=>{if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs allowlist create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/allowlist`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({comment:d(r.comment,`comment`,`text`),enabled:r.enabled,prefix:d(r.prefix,`prefix`,`text`)}):c(r.body)});return}let l=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.magicTransit.advancedTcpProtection.configs.allowlist.create({...e,account_id:p})),{successLabel:`Created`});return}if(r.comment===void 0&&(r.comment=await f(`comment`,`An comment describing the allowlist prefix.`)),r.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);r.prefix===void 0&&(r.prefix=await f(`prefix`,`The allowlist prefix to add in CIDR format.`));let m=u({comment:d(r.comment,`comment`,`text`),enabled:r.enabled,prefix:d(r.prefix,`prefix`,`text`)});a(await s(`Creating`,async()=>l.magicTransit.advancedTcpProtection.configs.allowlist.create({...m,account_id:p})),{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 r=>{if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs allowlist delete allowlist prefix`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/allowlist/${r[`prefix-id`]==null?`<prefix-id>`:encodeURIComponent(String(r[`prefix-id`]))}`,pathParams:{"prefix-id":String(r[`prefix-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
5
- `);return}a(await s(`Deleting`,async()=>c.magicTransit.advancedTcpProtection.configs.allowlist.delete.allowlist.prefix({account_id:l,prefix_id:r[`prefix-id`]})),{successLabel:`Deleted`})}},z={command:`allowlist`,describe:`Operations for advanced-tcp-protection.configs.allowlist.delete.allowlist`,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 r=>{if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs allowlist delete for account`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/allowlist`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
6
- `);return}a(await s(`Deleting`,async()=>c.magicTransit.advancedTcpProtection.configs.allowlist.delete.for.account({account_id:l})),{successLabel:`Deleted`})}},H={command:`for`,describe:`Operations for advanced-tcp-protection.configs.allowlist.delete.for`,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 r=>{if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs allowlist get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/allowlist/${r[`prefix-id`]==null?`<prefix-id>`:encodeURIComponent(String(r[`prefix-id`]))}`,pathParams:{"prefix-id":String(r[`prefix-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.magicTransit.advancedTcpProtection.configs.allowlist.get({account_id:l,prefix_id:r[`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 r=>{let c={page:r.page,per_page:r[`per-page`],order:r.order,direction:r.direction};if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs allowlist list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/allowlist`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.magicTransit.advancedTcpProtection.configs.allowlist.list({account_id:u,...c})),{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 r=>{if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs allowlist update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/allowlist/${r[`prefix-id`]==null?`<prefix-id>`:encodeURIComponent(String(r[`prefix-id`]))}`,pathParams:{"prefix-id":String(r[`prefix-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({comment:d(r.comment,`comment`,`text`),enabled:r.enabled}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.magicTransit.advancedTcpProtection.configs.allowlist.update({...e,account_id:f,prefix_id:r[`prefix-id`]})),{successLabel:`Updated`});return}let p=u({comment:d(r.comment,`comment`,`text`),enabled:r.enabled});a(await s(`Updating`,async()=>l.magicTransit.advancedTcpProtection.configs.allowlist.update({...p,account_id:f,prefix_id:r[`prefix-id`]})),{successLabel:`Updated`})}},X={command:`allowlist`,describe:`Operations for advanced-tcp-protection.configs.allowlist`,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 r=>{if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs prefixes bulk create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/prefixes/bulk`,pathParams:{},bodyKind:`json`,body:r.body===void 0?void 0:c(r.body)});return}let l=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.magicTransit.advancedTcpProtection.configs.prefixes.bulk.create({body:e,account_id:u})),{successLabel:`Created`});return}if(r.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},ne={command:`bulk`,describe:`Operations for advanced-tcp-protection.configs.prefixes.bulk`,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 r=>{if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs prefixes create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/prefixes`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({comment:d(r.comment,`comment`,`text`),excluded:r.excluded,prefix:d(r.prefix,`prefix`,`text`)}):c(r.body)});return}let l=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.magicTransit.advancedTcpProtection.configs.prefixes.create({body:e,account_id:p})),{successLabel:`Created`});return}if(r.comment===void 0&&(r.comment=await f(`comment`,`A comment describing the prefix.`)),r.excluded===void 0)throw Error(`--excluded is required (or pass --body with this field set).`);r.prefix===void 0&&(r.prefix=await f(`prefix`,`The prefix to add in CIDR format.`));let m=u({comment:d(r.comment,`comment`,`text`),excluded:r.excluded,prefix:d(r.prefix,`prefix`,`text`)});a(await s(`Creating`,async()=>l.magicTransit.advancedTcpProtection.configs.prefixes.create({body:m,account_id:p})),{successLabel:`Created`})}};function ae(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 oe={command:`delete <prefix-id>`,describe:`Delete the prefix for an account given a UUID.`,builder:ae,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs prefixes delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/prefixes/${r[`prefix-id`]==null?`<prefix-id>`:encodeURIComponent(String(r[`prefix-id`]))}`,pathParams:{"prefix-id":String(r[`prefix-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
7
- `);return}a(await s(`Deleting`,async()=>c.magicTransit.advancedTcpProtection.configs.prefixes.delete({account_id:l,prefix_id:r[`prefix-id`]})),{successLabel:`Deleted`})}};function se(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 ce={command:`get <prefix-id>`,describe:`Get a prefix specified by the given UUID.`,builder:se,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs prefixes get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/prefixes/${r[`prefix-id`]==null?`<prefix-id>`:encodeURIComponent(String(r[`prefix-id`]))}`,pathParams:{"prefix-id":String(r[`prefix-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.magicTransit.advancedTcpProtection.configs.prefixes.get({account_id:l,prefix_id:r[`prefix-id`]})),{successLabel:`Loaded`})}};function le(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 ue={command:`list`,describe:`List all prefixes for an account.`,builder:le,handler:async r=>{let c={page:r.page,per_page:r[`per-page`],order:r.order,direction:r.direction};if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs prefixes list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/prefixes`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.magicTransit.advancedTcpProtection.configs.prefixes.list({account_id:u,...c})),{successLabel:`Loaded`})}};function de(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 fe={command:`update <prefix-id>`,describe:`Update a prefix specified by the given UUID.`,builder:de,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs prefixes update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/prefixes/${r[`prefix-id`]==null?`<prefix-id>`:encodeURIComponent(String(r[`prefix-id`]))}`,pathParams:{"prefix-id":String(r[`prefix-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({comment:d(r.comment,`comment`,`text`),excluded:r.excluded}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.magicTransit.advancedTcpProtection.configs.prefixes.update({...e,account_id:f,prefix_id:r[`prefix-id`]})),{successLabel:`Updated`});return}let p=u({comment:d(r.comment,`comment`,`text`),excluded:r.excluded});a(await s(`Updating`,async()=>l.magicTransit.advancedTcpProtection.configs.prefixes.update({...p,account_id:f,prefix_id:r[`prefix-id`]})),{successLabel:`Updated`})}},pe={command:`prefixes`,describe:`Operations for advanced-tcp-protection.configs.prefixes`,builder:e=>e.command(ie).command(oe).command(ce).command(ue).command(fe).command(ne).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function me(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 he={command:`create`,describe:`Create a SYN Protection filter for an account.`,builder:me,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs syn protection filters create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/filters`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({expression:d(r.expression,`expression`,`text`),mode:d(r.mode,`mode`,`text`)}):c(r.body)});return}let l=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.magicTransit.advancedTcpProtection.configs.syn.protection.filters.create({body:e,account_id:p})),{successLabel:`Created`});return}r.expression===void 0&&(r.expression=await f(`expression`,`The filter expression.`)),r.mode===void 0&&(r.mode=await f(`mode`,`The filter's mode. Must be one of 'enabled', 'disabled', 'monitoring'.`));let m=u({expression:d(r.expression,`expression`,`text`),mode:d(r.mode,`mode`,`text`)});a(await s(`Creating`,async()=>l.magicTransit.advancedTcpProtection.configs.syn.protection.filters.create({body:m,account_id:p})),{successLabel:`Created`})}};function ge(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 _e={command:`account`,describe:`Delete all SYN Protection filters for an account.`,builder:ge,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs syn protection filters delete for account`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/filters`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
8
- `);return}a(await s(`Deleting`,async()=>c.magicTransit.advancedTcpProtection.configs.syn.protection.filters.delete.for.account({account_id:l})),{successLabel:`Deleted`})}},ve={command:`for`,describe:`Operations for advanced-tcp-protection.configs.syn.protection.filters.delete.for`,builder:e=>e.command(_e).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ye(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 be={command:`filter <filter-id>`,describe:`Delete a SYN Protection filter specified by the given UUID.`,builder:ye,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs syn protection filters delete protection filter`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/filters/${r[`filter-id`]==null?`<filter-id>`:encodeURIComponent(String(r[`filter-id`]))}`,pathParams:{"filter-id":String(r[`filter-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
9
- `);return}a(await s(`Deleting`,async()=>c.magicTransit.advancedTcpProtection.configs.syn.protection.filters.delete.protection.filter({account_id:l,filter_id:r[`filter-id`]})),{successLabel:`Deleted`})}},xe={command:`protection`,describe:`Operations for advanced-tcp-protection.configs.syn.protection.filters.delete.protection`,builder:e=>e.command(be).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Se={command:`delete`,describe:`Operations for advanced-tcp-protection.configs.syn.protection.filters.delete`,builder:e=>e.command(ve).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 retrieve.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const we={command:`get <filter-id>`,describe:`Get a SYN Protection filter specified by the given UUID.`,builder:Ce,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs syn protection filters get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/filters/${r[`filter-id`]==null?`<filter-id>`:encodeURIComponent(String(r[`filter-id`]))}`,pathParams:{"filter-id":String(r[`filter-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.magicTransit.advancedTcpProtection.configs.syn.protection.filters.get({account_id:l,filter_id:r[`filter-id`]})),{successLabel:`Loaded`})}};function Te(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 Ee={command:`list`,describe:`List all SYN Protection filters for an account.`,builder:Te,handler:async r=>{let c={mode:r.mode,page:r.page,per_page:r[`per-page`],order:r.order,direction:r.direction};if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs syn protection filters list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/filters`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.magicTransit.advancedTcpProtection.configs.syn.protection.filters.list({account_id:u,...c})),{successLabel:`Loaded`})}};function De(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 Oe={command:`update <filter-id>`,describe:`Update a SYN Protection filter specified by the given UUID.`,builder:De,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs syn protection filters update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/filters/${r[`filter-id`]==null?`<filter-id>`:encodeURIComponent(String(r[`filter-id`]))}`,pathParams:{"filter-id":String(r[`filter-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({expression:d(r.expression,`expression`,`text`),mode:d(r.mode,`mode`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.magicTransit.advancedTcpProtection.configs.syn.protection.filters.update({body:e,account_id:f,filter_id:r[`filter-id`]})),{successLabel:`Updated`});return}let p=u({expression:d(r.expression,`expression`,`text`),mode:d(r.mode,`mode`,`text`)});a(await s(`Updating`,async()=>l.magicTransit.advancedTcpProtection.configs.syn.protection.filters.update({body:p,account_id:f,filter_id:r[`filter-id`]})),{successLabel:`Updated`})}},ke={command:`filters`,describe:`Operations for advanced-tcp-protection.configs.syn.protection.filters`,builder:e=>e.command(he).command(we).command(Ee).command(Oe).command(Se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ae(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 je={command:`create`,describe:`Create a SYN Protection rule for an account.`,builder:Ae,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs syn protection rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/rules`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({burst_sensitivity:d(r[`burst-sensitivity`],`burst-sensitivity`,`text`),mitigation_type:d(r[`mitigation-type`],`mitigation-type`,`text`),mode:d(r.mode,`mode`,`text`),name:d(r.name,`name`,`text`),rate_sensitivity:d(r[`rate-sensitivity`],`rate-sensitivity`,`text`),scope:d(r.scope,`scope`,`text`)}):c(r.body)});return}let l=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.magicTransit.advancedTcpProtection.configs.syn.protection.rules.create({...e,account_id:p})),{successLabel:`Created`});return}r[`burst-sensitivity`]===void 0&&(r[`burst-sensitivity`]=await f(`burst-sensitivity`,`The burst sensitivity. Must be one of 'low', 'medium', 'high'.`)),r.mode===void 0&&(r.mode=await f(`mode`,`The mode for SYN Protection. Must be one of 'enabled', 'disabled', 'monitoring'.`)),r.name===void 0&&(r.name=await f(`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'.`)),r[`rate-sensitivity`]===void 0&&(r[`rate-sensitivity`]=await f(`rate-sensitivity`,`The rate sensitivity. Must be one of 'low', 'medium', 'high'.`)),r.scope===void 0&&(r.scope=await f(`scope`,`The scope for the SYN Protection rule. Must be one of 'global', 'region', or 'datacenter'.`));let m=u({burst_sensitivity:d(r[`burst-sensitivity`],`burst-sensitivity`,`text`),mitigation_type:d(r[`mitigation-type`],`mitigation-type`,`text`),mode:d(r.mode,`mode`,`text`),name:d(r.name,`name`,`text`),rate_sensitivity:d(r[`rate-sensitivity`],`rate-sensitivity`,`text`),scope:d(r.scope,`scope`,`text`)});a(await s(`Creating`,async()=>l.magicTransit.advancedTcpProtection.configs.syn.protection.rules.create({...m,account_id:p})),{successLabel:`Created`})}};function Me(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 Ne={command:`account`,describe:`Delete all SYN Protection rules for an account.`,builder:Me,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs syn protection rules delete for account`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/rules`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
10
- `);return}a(await s(`Deleting`,async()=>c.magicTransit.advancedTcpProtection.configs.syn.protection.rules.delete.for.account({account_id:l})),{successLabel:`Deleted`})}},Pe={command:`for`,describe:`Operations for advanced-tcp-protection.configs.syn.protection.rules.delete.for`,builder:e=>e.command(Ne).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Fe(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 Ie={command:`rule <rule-id>`,describe:`Delete a SYN Protection rule specified by the given UUID.`,builder:Fe,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs syn protection rules delete protection rule`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/rules/${r[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(r[`rule-id`]))}`,pathParams:{"rule-id":String(r[`rule-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
11
- `);return}a(await s(`Deleting`,async()=>c.magicTransit.advancedTcpProtection.configs.syn.protection.rules.delete.protection.rule({account_id:l,rule_id:r[`rule-id`]})),{successLabel:`Deleted`})}},Le={command:`protection`,describe:`Operations for advanced-tcp-protection.configs.syn.protection.rules.delete.protection`,builder:e=>e.command(Ie).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Re={command:`delete`,describe:`Operations for advanced-tcp-protection.configs.syn.protection.rules.delete`,builder:e=>e.command(Pe).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.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Be={command:`get <rule-id>`,describe:`Get a SYN Protection rule specified by the given UUID.`,builder:ze,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs syn protection rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/rules/${r[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(r[`rule-id`]))}`,pathParams:{"rule-id":String(r[`rule-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.magicTransit.advancedTcpProtection.configs.syn.protection.rules.get({account_id:l,rule_id:r[`rule-id`]})),{successLabel:`Loaded`})}};function Ve(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 He={command:`list`,describe:`List all SYN Protection rules for an account.`,builder:Ve,handler:async r=>{let c={page:r.page,per_page:r[`per-page`],order:r.order,direction:r.direction};if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs syn protection rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/rules`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.magicTransit.advancedTcpProtection.configs.syn.protection.rules.list({account_id:u,...c})),{successLabel:`Loaded`})}};function Ue(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 We={command:`update <rule-id>`,describe:`Update a SYN Protection rule specified by the given UUID.`,builder:Ue,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs syn protection rules update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/rules/${r[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(r[`rule-id`]))}`,pathParams:{"rule-id":String(r[`rule-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({burst_sensitivity:d(r[`burst-sensitivity`],`burst-sensitivity`,`text`),mitigation_type:d(r[`mitigation-type`],`mitigation-type`,`text`),mode:d(r.mode,`mode`,`text`),rate_sensitivity:d(r[`rate-sensitivity`],`rate-sensitivity`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.magicTransit.advancedTcpProtection.configs.syn.protection.rules.update({...e,account_id:f,rule_id:r[`rule-id`]})),{successLabel:`Updated`});return}let p=u({burst_sensitivity:d(r[`burst-sensitivity`],`burst-sensitivity`,`text`),mitigation_type:d(r[`mitigation-type`],`mitigation-type`,`text`),mode:d(r.mode,`mode`,`text`),rate_sensitivity:d(r[`rate-sensitivity`],`rate-sensitivity`,`text`)});a(await s(`Updating`,async()=>l.magicTransit.advancedTcpProtection.configs.syn.protection.rules.update({...p,account_id:f,rule_id:r[`rule-id`]})),{successLabel:`Updated`})}},Ge={command:`rules`,describe:`Operations for advanced-tcp-protection.configs.syn.protection.rules`,builder:e=>e.command(je).command(Be).command(He).command(We).command(Re).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ke={command:`protection`,describe:`Operations for advanced-tcp-protection.configs.syn.protection`,builder:e=>e.command(ke).command(Ge).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},qe={command:`syn`,describe:`Operations for advanced-tcp-protection.configs.syn`,builder:e=>e.command(Ke).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Je(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 TCP Flow Protection filter for an account.`,builder:Je,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection filters create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({expression:d(r.expression,`expression`,`text`),mode:d(r.mode,`mode`,`text`)}):c(r.body)});return}let l=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.filters.create({body:e,account_id:p})),{successLabel:`Created`});return}r.expression===void 0&&(r.expression=await f(`expression`,`The filter expression.`)),r.mode===void 0&&(r.mode=await f(`mode`,`The filter's mode. Must be one of 'enabled', 'disabled', 'monitoring'.`));let m=u({expression:d(r.expression,`expression`,`text`),mode:d(r.mode,`mode`,`text`)});a(await s(`Creating`,async()=>l.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.filters.create({body:m,account_id:p})),{successLabel:`Created`})}};function Xe(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 Ze={command:`account`,describe:`Delete all TCP Flow Protection filters for an account.`,builder:Xe,handler:async r=>{if(r.dryRun){o({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/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
12
- `);return}a(await s(`Deleting`,async()=>c.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.filters.delete.for.account({account_id:l})),{successLabel:`Deleted`})}},Qe={command:`for`,describe:`Operations for advanced-tcp-protection.configs.tcp.flow.protection.filters.delete.for`,builder:e=>e.command(Ze).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function $e(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 et={command:`filter <filter-id>`,describe:`Delete a TCP Flow Protection filter specified by the given UUID.`,builder:$e,handler:async r=>{if(r.dryRun){o({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/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters/${r[`filter-id`]==null?`<filter-id>`:encodeURIComponent(String(r[`filter-id`]))}`,pathParams:{"filter-id":String(r[`filter-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
13
- `);return}a(await s(`Deleting`,async()=>c.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.filters.delete.protection.filter({account_id:l,filter_id:r[`filter-id`]})),{successLabel:`Deleted`})}},tt={command:`protection`,describe:`Operations for advanced-tcp-protection.configs.tcp.flow.protection.filters.delete.protection`,builder:e=>e.command(et).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},nt={command:`delete`,describe:`Operations for advanced-tcp-protection.configs.tcp.flow.protection.filters.delete`,builder:e=>e.command(Qe).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 retrieve.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const it={command:`get <filter-id>`,describe:`Get a TCP Flow Protection filter specified by the given UUID.`,builder:rt,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection filters get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters/${r[`filter-id`]==null?`<filter-id>`:encodeURIComponent(String(r[`filter-id`]))}`,pathParams:{"filter-id":String(r[`filter-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.filters.get({account_id:l,filter_id:r[`filter-id`]})),{successLabel:`Loaded`})}};function at(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 ot={command:`list`,describe:`List all TCP Flow Protection filters for an account.`,builder:at,handler:async r=>{let c={mode:r.mode,page:r.page,per_page:r[`per-page`],order:r.order,direction:r.direction};if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection filters list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.filters.list({account_id:u,...c})),{successLabel:`Loaded`})}};function st(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 ct={command:`update <filter-id>`,describe:`Update a TCP Flow Protection filter specified by the given UUID.`,builder:st,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection filters update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters/${r[`filter-id`]==null?`<filter-id>`:encodeURIComponent(String(r[`filter-id`]))}`,pathParams:{"filter-id":String(r[`filter-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({expression:d(r.expression,`expression`,`text`),mode:d(r.mode,`mode`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.filters.update({body:e,account_id:f,filter_id:r[`filter-id`]})),{successLabel:`Updated`});return}let p=u({expression:d(r.expression,`expression`,`text`),mode:d(r.mode,`mode`,`text`)});a(await s(`Updating`,async()=>l.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.filters.update({body:p,account_id:f,filter_id:r[`filter-id`]})),{successLabel:`Updated`})}},lt={command:`filters`,describe:`Operations for advanced-tcp-protection.configs.tcp.flow.protection.filters`,builder:e=>e.command(Ye).command(it).command(ot).command(ct).command(nt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ut(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 dt={command:`create`,describe:`Create a TCP Flow Protection rule for an account.`,builder:ut,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({burst_sensitivity:d(r[`burst-sensitivity`],`burst-sensitivity`,`text`),mode:d(r.mode,`mode`,`text`),name:d(r.name,`name`,`text`),rate_sensitivity:d(r[`rate-sensitivity`],`rate-sensitivity`,`text`),scope:d(r.scope,`scope`,`text`)}):c(r.body)});return}let l=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.rules.create({...e,account_id:p})),{successLabel:`Created`});return}r[`burst-sensitivity`]===void 0&&(r[`burst-sensitivity`]=await f(`burst-sensitivity`,`The burst sensitivity. Must be one of 'low', 'medium', 'high'.`)),r.mode===void 0&&(r.mode=await f(`mode`,`The mode for the TCP Flow Protection. Must be one of 'enabled', 'disabled', 'monitoring'.`)),r.name===void 0&&(r.name=await f(`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'.`)),r[`rate-sensitivity`]===void 0&&(r[`rate-sensitivity`]=await f(`rate-sensitivity`,`The rate sensitivity. Must be one of 'low', 'medium', 'high'.`)),r.scope===void 0&&(r.scope=await f(`scope`,`The scope for the TCP Flow Protection rule.`));let m=u({burst_sensitivity:d(r[`burst-sensitivity`],`burst-sensitivity`,`text`),mode:d(r.mode,`mode`,`text`),name:d(r.name,`name`,`text`),rate_sensitivity:d(r[`rate-sensitivity`],`rate-sensitivity`,`text`),scope:d(r.scope,`scope`,`text`)});a(await s(`Creating`,async()=>l.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.rules.create({...m,account_id:p})),{successLabel:`Created`})}};function ft(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 pt={command:`account`,describe:`Delete all TCP Flow Protection rules for an account.`,builder:ft,handler:async r=>{if(r.dryRun){o({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/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
14
- `);return}a(await s(`Deleting`,async()=>c.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.rules.delete.for.account({account_id:l})),{successLabel:`Deleted`})}},mt={command:`for`,describe:`Operations for advanced-tcp-protection.configs.tcp.flow.protection.rules.delete.for`,builder:e=>e.command(pt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ht(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 gt={command:`rule <rule-id>`,describe:`Delete a TCP Flow Protection rule specified by the given UUID.`,builder:ht,handler:async r=>{if(r.dryRun){o({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/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules/${r[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(r[`rule-id`]))}`,pathParams:{"rule-id":String(r[`rule-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
15
- `);return}a(await s(`Deleting`,async()=>c.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.rules.delete.protection.rule({account_id:l,rule_id:r[`rule-id`]})),{successLabel:`Deleted`})}},_t={command:`protection`,describe:`Operations for advanced-tcp-protection.configs.tcp.flow.protection.rules.delete.protection`,builder:e=>e.command(gt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},vt={command:`delete`,describe:`Operations for advanced-tcp-protection.configs.tcp.flow.protection.rules.delete`,builder:e=>e.command(mt).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.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const bt={command:`get <rule-id>`,describe:`Get a TCP Flow Protection rule specified by the given UUID.`,builder:yt,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules/${r[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(r[`rule-id`]))}`,pathParams:{"rule-id":String(r[`rule-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.rules.get({account_id:l,rule_id:r[`rule-id`]})),{successLabel:`Loaded`})}};function xt(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 St={command:`list`,describe:`List all TCP Flow Protection rules for an account.`,builder:xt,handler:async r=>{let c={page:r.page,per_page:r[`per-page`],order:r.order,direction:r.direction};if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.rules.list({account_id:u,...c})),{successLabel:`Loaded`})}};function Ct(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 wt={command:`update <rule-id>`,describe:`Update a TCP Flow Protection rule specified by the given UUID.`,builder:Ct,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection rules update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules/${r[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(r[`rule-id`]))}`,pathParams:{"rule-id":String(r[`rule-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({burst_sensitivity:d(r[`burst-sensitivity`],`burst-sensitivity`,`text`),mode:d(r.mode,`mode`,`text`),rate_sensitivity:d(r[`rate-sensitivity`],`rate-sensitivity`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.rules.update({...e,account_id:f,rule_id:r[`rule-id`]})),{successLabel:`Updated`});return}let p=u({burst_sensitivity:d(r[`burst-sensitivity`],`burst-sensitivity`,`text`),mode:d(r.mode,`mode`,`text`),rate_sensitivity:d(r[`rate-sensitivity`],`rate-sensitivity`,`text`)});a(await s(`Updating`,async()=>l.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.rules.update({...p,account_id:f,rule_id:r[`rule-id`]})),{successLabel:`Updated`})}},Tt={command:`rules`,describe:`Operations for advanced-tcp-protection.configs.tcp.flow.protection.rules`,builder:e=>e.command(dt).command(bt).command(St).command(wt).command(vt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Et={command:`protection`,describe:`Operations for advanced-tcp-protection.configs.tcp.flow.protection`,builder:e=>e.command(lt).command(Tt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Dt={command:`flow`,describe:`Operations for advanced-tcp-protection.configs.tcp.flow`,builder:e=>e.command(Et).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ot(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const kt={command:`get`,describe:`Get the protection status of the account.`,builder:Ot,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs tcp protection status get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_protection_status`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.magicTransit.advancedTcpProtection.configs.tcp.protection.status.get({account_id:l})),{successLabel:`Loaded`})}};function At(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 jt={command:`update`,describe:`Update the protection status of the account.`,builder:At,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit advanced-tcp-protection configs tcp protection status update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_protection_status`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({enabled:r.enabled}):c(r.body)});return}let l=await i(r),d=r.local?e:await t();if(r.accountId=d,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.magicTransit.advancedTcpProtection.configs.tcp.protection.status.update({...e,account_id:d})),{successLabel:`Updated`});return}if(r.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);let f=u({enabled:r.enabled});a(await s(`Updating`,async()=>l.magicTransit.advancedTcpProtection.configs.tcp.protection.status.update({...f,account_id:d})),{successLabel:`Updated`})}},Mt={command:`status`,describe:`Operations for advanced-tcp-protection.configs.tcp.protection.status`,builder:e=>e.command(kt).command(jt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Nt={command:`protection`,describe:`Operations for advanced-tcp-protection.configs.tcp.protection`,builder:e=>e.command(Mt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Pt={command:`tcp`,describe:`Operations for advanced-tcp-protection.configs.tcp`,builder:e=>e.command(Dt).command(Nt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ft={command:`configs`,describe:`Operations for advanced-tcp-protection.configs`,builder:e=>e.command(X).command(pe).command(qe).command(Pt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},It={command:`advanced-tcp-protection`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(Ft).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Lt(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 Rt={command:`create`,describe:`Creates a new App for an account`,builder:Lt,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit apps create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/apps`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({hostnames:r.hostnames,name:d(r.name,`name`,`text`),type:d(r.type,`type`,`text`)}):c(r.body)});return}let l=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.magicTransit.apps.create({body:e,account_id:p})),{successLabel:`Created`});return}r.name===void 0&&(r.name=await f(`name`,`Display name for the app.`)),r.type===void 0&&(r.type=await f(`type`,`Category of the app.`));let m=u({hostnames:r.hostnames,name:d(r.name,`name`,`text`),type:d(r.type,`type`,`text`)});a(await s(`Creating`,async()=>l.magicTransit.apps.create({body:m,account_id:p})),{successLabel:`Created`})}};function zt(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 Bt={command:`delete <account-app-id>`,describe:`Deletes specific Account App.`,builder:zt,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit apps delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/apps/${r[`account-app-id`]==null?`<account-app-id>`:encodeURIComponent(String(r[`account-app-id`]))}`,pathParams:{"account-app-id":String(r[`account-app-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
16
- `);return}a(await s(`Deleting`,async()=>c.magicTransit.apps.delete({account_id:l,account_app_id:r[`account-app-id`]})),{successLabel:`Deleted`})}};function Vt(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 Ht={command:`edit <account-app-id>`,describe:`Updates an Account App`,builder:Vt,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit apps edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/apps/${r[`account-app-id`]==null?`<account-app-id>`:encodeURIComponent(String(r[`account-app-id`]))}`,pathParams:{"account-app-id":String(r[`account-app-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({hostnames:r.hostnames,name:d(r.name,`name`,`text`),type:d(r.type,`type`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.magicTransit.apps.edit({body:e,account_id:f,account_app_id:r[`account-app-id`]})),{successLabel:`Updated`});return}let p=u({hostnames:r.hostnames,name:d(r.name,`name`,`text`),type:d(r.type,`type`,`text`)});a(await s(`Updating`,async()=>l.magicTransit.apps.edit({body:p,account_id:f,account_app_id:r[`account-app-id`]})),{successLabel:`Updated`})}};function Ut(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Wt={command:`list`,describe:`Lists Apps associated with an account.`,builder:Ut,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit apps list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/apps`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.magicTransit.apps.list({account_id:l})),{successLabel:`Loaded`})}};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:`update <account-app-id>`,describe:`Updates an Account App`,builder:Gt,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit apps update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/apps/${r[`account-app-id`]==null?`<account-app-id>`:encodeURIComponent(String(r[`account-app-id`]))}`,pathParams:{"account-app-id":String(r[`account-app-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({hostnames:r.hostnames,name:d(r.name,`name`,`text`),type:d(r.type,`type`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.magicTransit.apps.update({body:e,account_id:f,account_app_id:r[`account-app-id`]})),{successLabel:`Updated`});return}let p=u({hostnames:r.hostnames,name:d(r.name,`name`,`text`),type:d(r.type,`type`,`text`)});a(await s(`Updating`,async()=>l.magicTransit.apps.update({body:p,account_id:f,account_app_id:r[`account-app-id`]})),{successLabel:`Updated`})}},qt={command:`apps`,describe:`Application-aware traffic policies for Magic WAN that steer traffic by app type`,builder:e=>e.command(Rt).command(Bt).command(Ht).command(Wt).command(Kt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Jt(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 Yt={command:`create`,describe:`Creates a new BGP filter profile for an account.`,builder:Jt,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit bgp-filter-profiles create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/bgp/filter_profiles`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({description:d(r.description,`description`,`text`),match_action:d(r[`match-action`],`match-action`,`text`),name:d(r.name,`name`,`text`),targets:r.targets}):c(r.body)});return}let l=await i(r),m=r.local?e:await t();if(r.accountId=m,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.magicTransit.bgpFilterProfiles.create({...e,account_id:m})),{successLabel:`Created`});return}if(r[`match-action`]===void 0&&(r[`match-action`]=await p(`match-action`,`Action to take when a route matches one of the targets in this profile`,[`allow`,`deny`])),r.name===void 0&&(r.name=await f(`name`,`Friendly name for the filter profile`)),r.targets===void 0)throw Error(`--targets is required (or pass --body with this field set).`);let h=u({description:d(r.description,`description`,`text`),match_action:d(r[`match-action`],`match-action`,`text`),name:d(r.name,`name`,`text`),targets:r.targets});a(await s(`Creating`,async()=>l.magicTransit.bgpFilterProfiles.create({...h,account_id:m})),{successLabel:`Created`})}};function Xt(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 Zt={command:`delete <profile-id>`,describe:`Deletes a BGP filter profile.`,builder:Xt,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit bgp-filter-profiles delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/bgp/filter_profiles/${r[`profile-id`]==null?`<profile-id>`:encodeURIComponent(String(r[`profile-id`]))}`,pathParams:{"profile-id":String(r[`profile-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
17
- `);return}a(await s(`Deleting`,async()=>c.magicTransit.bgpFilterProfiles.delete({account_id:l,profile_id:r[`profile-id`]})),{successLabel:`Deleted`})}};function Qt(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 $t={command:`get <profile-id>`,describe:`Gets a specific BGP filter profile for an account.`,builder:Qt,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit bgp-filter-profiles get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/bgp/filter_profiles/${r[`profile-id`]==null?`<profile-id>`:encodeURIComponent(String(r[`profile-id`]))}`,pathParams:{"profile-id":String(r[`profile-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.magicTransit.bgpFilterProfiles.get({account_id:l,profile_id:r[`profile-id`]})),{successLabel:`Loaded`})}};function en(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const tn={command:`list`,describe:`Lists all BGP filter profiles for an account.`,builder:en,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit bgp-filter-profiles list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/bgp/filter_profiles`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.magicTransit.bgpFilterProfiles.list({account_id:l})),{successLabel:`Loaded`})}};function nn(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 rn={command:`update <profile-id>`,describe:'Updates a BGP filter profile. Omitted properties are left unchanged. To clear an existing description send `description: ""`.',builder:nn,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit bgp-filter-profiles update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/bgp/filter_profiles/${r[`profile-id`]==null?`<profile-id>`:encodeURIComponent(String(r[`profile-id`]))}`,pathParams:{"profile-id":String(r[`profile-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({description:d(r.description,`description`,`text`),match_action:d(r[`match-action`],`match-action`,`text`),name:d(r.name,`name`,`text`),targets:r.targets}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.magicTransit.bgpFilterProfiles.update({...e,account_id:f,profile_id:r[`profile-id`]})),{successLabel:`Updated`});return}let p=u({description:d(r.description,`description`,`text`),match_action:d(r[`match-action`],`match-action`,`text`),name:d(r.name,`name`,`text`),targets:r.targets});a(await s(`Updating`,async()=>l.magicTransit.bgpFilterProfiles.update({...p,account_id:f,profile_id:r[`profile-id`]})),{successLabel:`Updated`})}},an={command:`bgp-filter-profiles`,describe:`BGP filter profiles for controlling which routes are allowed or denied on Magic Transit tunnels`,builder:e=>e.command(Yt).command(Zt).command($t).command(tn).command(rn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function on(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const sn={command:`get`,describe:`Gets the BGP settings for an account, including the default ASN and redistribution configuration.`,builder:on,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit bgp-settings get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/bgp/settings`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.magicTransit.bgpSettings.get({account_id:l})),{successLabel:`Loaded`})}};function cn(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 ln={command:`update`,describe:`Modifies the BGP settings for an account, including the default ASN and redistribution configuration.`,builder:cn,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit bgp-settings update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/bgp/settings`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({cloudflare_asn:r[`cloudflare-asn`],redistribute:{"static:wan":r[`redistribute-static:wan`]}}):c(r.body)});return}let l=await i(r),d=r.local?e:await t();if(r.accountId=d,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.magicTransit.bgpSettings.update({...e,account_id:d})),{successLabel:`Updated`});return}let f=u({cloudflare_asn:r[`cloudflare-asn`],redistribute:{"static:wan":r[`redistribute-static:wan`]}});a(await s(`Updating`,async()=>l.magicTransit.bgpSettings.update({...f,account_id:d})),{successLabel:`Updated`})}},un={command:`bgp-settings`,describe:`BGP settings for controlling default ASN and route redistribution on Magic Transit tunnels`,builder:e=>e.command(sn).command(ln).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function dn(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 fn={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:dn,handler:async l=>{let u={};if(l[`x-magic-new-hc-target`]!==void 0&&(u[`x-magic-new-hc-target`]=String(l[`x-magic-new-hc-target`])),l.dryRun){o({command:`cf magic-transit cf-interconnects bulk-update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/cf_interconnects`,pathParams:{},bodyKind:`json`,body:l.body===void 0?void 0:c(l.body)});return}let d=await i(l),f=l.local?e:await t();if(l.accountId=f,l.body){let e=c(l.body);a(await s(`Updating`,async()=>r(d,`PUT`,`/accounts/${f}/magic/cf_interconnects`,{body:e,headers:Object.keys(u).length>0?u:void 0})),{successLabel:`Updated`});return}a(await s(`Updating`,async()=>r(d,`PUT`,`/accounts/${f}/magic/cf_interconnects`,{headers:Object.keys(u).length>0?u:void 0})),{successLabel:`Updated`})}};function pn(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 mn={command:`get <cf-interconnect-id>`,describe:`Lists details for a specific interconnect.`,builder:pn,handler:async c=>{let l={};if(c[`x-magic-new-hc-target`]!==void 0&&(l[`x-magic-new-hc-target`]=String(c[`x-magic-new-hc-target`])),c.dryRun){o({command:`cf magic-transit cf-interconnects get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/cf_interconnects/${c[`cf-interconnect-id`]==null?`<cf-interconnect-id>`:encodeURIComponent(String(c[`cf-interconnect-id`]))}`,pathParams:{"cf-interconnect-id":String(c[`cf-interconnect-id`]??``)},bodyKind:`none`});return}let u=await i(c),d=c.local?e:await t();c.accountId=d,a(await s(`Loading`,async()=>r(u,`GET`,`/accounts/${d}/magic/cf_interconnects/${encodeURIComponent(String(c[`cf-interconnect-id`]))}`,{headers:Object.keys(l).length>0?l:void 0})),{successLabel:`Loaded`})}};function hn(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 interconnects associated with an account.`,builder:hn,handler:async c=>{let l={};if(c[`x-magic-new-hc-target`]!==void 0&&(l[`x-magic-new-hc-target`]=String(c[`x-magic-new-hc-target`])),c.dryRun){o({command:`cf magic-transit cf-interconnects list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/cf_interconnects`,pathParams:{},bodyKind:`none`});return}let u=await i(c),d=c.local?e:await t();c.accountId=d,a(await s(`Loading`,async()=>r(u,`GET`,`/accounts/${d}/magic/cf_interconnects`,{headers:Object.keys(l).length>0?l:void 0})),{successLabel:`Loaded`})}};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 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-as-no`,{type:`number`,description:`Deprecated. Use customer_asn.`}).option(`bgp-cloudflare-endpoint`,{type:`string`,description:`Read-only for v1.5; derived from interface_address.`}).option(`bgp-customer-asn`,{type:`number`,description:`ASN used on the customer end of the BGP session.`}).option(`bgp-customer-endpoint`,{type:`string`,description:`Read-only for v1.5; derived from interface_address.`}).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.
18
-
19
- Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the
20
- key is not treated as a secret value. This is *only* supported for preventing
21
- misconfiguration, not for defending against malicious attacks.
22
-
23
- The MD5 key, if set, must be of non-zero length and consist only of the following types of
24
- character:
25
-
26
- * ASCII alphanumerics: \`[a-zA-Z0-9]\`
27
- * Special characters in the set \`'!@#$%^&*()+[]{}<>/.,;:_-~\`= \\|\`
28
-
29
- In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A),
30
- quotation mark (\`"\`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed
31
- (0x0C), and the question mark (\`?\`). Requests specifying an MD5 key with one or more of
32
- these disallowed characters 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(`health-check-direction`,{type:`string`,description:`The direction of the flow of the healthcheck. Either unidirectional, where the probe comes to you via the interconnect and the result comes back to Cloudflare via the open Internet, or bidirectional where both the probe and result come and go via the interconnect.`,choices:[`unidirectional`,`bidirectional`]}).option(`health-check-source`,{type:`string`,description:"The source IPv4 address used for bidirectional health checks. Supported only for version 1.5 interconnects. It is required when `direction` is `bidirectional` and must be omitted (and is cleared) when `direction` is `unidirectional`. The address must be within RFC1918 space, the approved link-local range 169.254.240.0/20, or the Cloudflare reserved range 198.41.199.224/27."}).option(`interface-address`,{type:`string`,description:`The IPv4 interface address for the interconnect. For MPLS Interconnects,
33
- use a /30 or /31 prefix. For GRE Interconnects, a /30 or /31 prefix
34
- may be used. Version 1.5 interconnects require a /31 prefix and may
35
- also use a prefix from the account's authorized prefixes; otherwise,
36
- select the subnet from RFC 1918 or the approved link-local ranges.
37
- `}).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 vn={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:_n,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){o({command:`cf magic-transit cf-interconnects update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<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?u({automatic_return_routing:f[`automatic-return-routing`],bgp:{as_no:f[`bgp-as-no`],cloudflare_endpoint:d(f[`bgp-cloudflare-endpoint`],`bgp-cloudflare-endpoint`,`text`),customer_asn:f[`bgp-customer-asn`],customer_endpoint:d(f[`bgp-customer-endpoint`],`bgp-customer-endpoint`,`text`),export_filter_id:d(f[`bgp-export-filter-id`],`bgp-export-filter-id`,`text`),extra_prefixes:f[`bgp-extra-prefixes`],import_filter_id:d(f[`bgp-import-filter-id`],`bgp-import-filter-id`,`text`),md5_key:d(f[`bgp-md5-key`],`bgp-md5-key`,`text`)},description:d(f.description,`description`,`text`),gre:{cloudflare_endpoint:d(f[`gre-cloudflare-endpoint`],`gre-cloudflare-endpoint`,`text`)},health_check:{enabled:f[`health-check-enabled`],rate:d(f[`health-check-rate`],`health-check-rate`,`text`),target:{saved:d(f[`health-check-target-saved`],`health-check-target-saved`,`text`)},type:d(f[`health-check-type`],`health-check-type`,`text`),direction:d(f[`health-check-direction`],`health-check-direction`,`text`),source:d(f[`health-check-source`],`health-check-source`,`text`)},interface_address:d(f[`interface-address`],`interface-address`,`text`),interface_address6:d(f[`interface-address6`],`interface-address6`,`text`),mtu:f.mtu,name:d(f.name,`name`,`text`)}):c(f.body)});return}let m=await i(f),h=f.local?e:await t();if(f.accountId=h,f.body){let e=c(f.body);a(await s(`Updating`,async()=>r(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&&l(g,[`automatic_return_routing`],f[`automatic-return-routing`]),f[`bgp-as-no`]!==void 0&&l(g,[`bgp`,`as_no`],f[`bgp-as-no`]),f[`bgp-cloudflare-endpoint`]!==void 0&&l(g,[`bgp`,`cloudflare_endpoint`],d(f[`bgp-cloudflare-endpoint`],`bgp-cloudflare-endpoint`,`text`)),f[`bgp-customer-asn`]!==void 0&&l(g,[`bgp`,`customer_asn`],f[`bgp-customer-asn`]),f[`bgp-customer-endpoint`]!==void 0&&l(g,[`bgp`,`customer_endpoint`],d(f[`bgp-customer-endpoint`],`bgp-customer-endpoint`,`text`)),f[`bgp-export-filter-id`]!==void 0&&l(g,[`bgp`,`export_filter_id`],d(f[`bgp-export-filter-id`],`bgp-export-filter-id`,`text`)),f[`bgp-extra-prefixes`]!==void 0&&l(g,[`bgp`,`extra_prefixes`],f[`bgp-extra-prefixes`]),f[`bgp-import-filter-id`]!==void 0&&l(g,[`bgp`,`import_filter_id`],d(f[`bgp-import-filter-id`],`bgp-import-filter-id`,`text`)),f[`bgp-md5-key`]!==void 0&&l(g,[`bgp`,`md5_key`],d(f[`bgp-md5-key`],`bgp-md5-key`,`text`)),f.description!==void 0&&l(g,[`description`],d(f.description,`description`,`text`)),f[`gre-cloudflare-endpoint`]!==void 0&&l(g,[`gre`,`cloudflare_endpoint`],d(f[`gre-cloudflare-endpoint`],`gre-cloudflare-endpoint`,`text`)),f[`health-check-enabled`]!==void 0&&l(g,[`health_check`,`enabled`],f[`health-check-enabled`]),f[`health-check-rate`]!==void 0&&l(g,[`health_check`,`rate`],d(f[`health-check-rate`],`health-check-rate`,`text`)),f[`health-check-target-saved`]!==void 0&&l(g,[`health_check`,`target`,`saved`],d(f[`health-check-target-saved`],`health-check-target-saved`,`text`)),f[`health-check-type`]!==void 0&&l(g,[`health_check`,`type`],d(f[`health-check-type`],`health-check-type`,`text`)),f[`health-check-direction`]!==void 0&&l(g,[`health_check`,`direction`],d(f[`health-check-direction`],`health-check-direction`,`text`)),f[`health-check-source`]!==void 0&&l(g,[`health_check`,`source`],d(f[`health-check-source`],`health-check-source`,`text`)),f[`interface-address`]!==void 0&&l(g,[`interface_address`],d(f[`interface-address`],`interface-address`,`text`)),f[`interface-address6`]!==void 0&&l(g,[`interface_address6`],d(f[`interface-address6`],`interface-address6`,`text`)),f.mtu!==void 0&&l(g,[`mtu`],f.mtu),f.name!==void 0&&l(g,[`name`],d(f.name,`name`,`text`)),a(await s(`Updating`,async()=>r(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`})}},yn={command:`cf-interconnects`,describe:`Cloudflare Network Interconnect (CNI) links for direct physical or virtual peering`,builder:e=>e.command(fn).command(mn).command(gn).command(vn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function bn(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 xn={command:`create`,describe:`Creates new CF1 Sites for an account. Each site must have a unique name within the account.`,builder:bn,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit cf1-sites create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/cf1_sites`,pathParams:{},bodyKind:`json`,body:r.body===void 0?void 0:c(r.body)});return}let l=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.magicTransit.cf1Sites.create({body:e,account_id:u})),{successLabel:`Created`});return}if(r.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function Sn(e){return e.positional(`cf1-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 Cn={command:`delete <cf1-site-id>`,describe:`Deletes a specific CF1 Site for an account.`,builder:Sn,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit cf1-sites delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/cf1_sites/${r[`cf1-site-id`]==null?`<cf1-site-id>`:encodeURIComponent(String(r[`cf1-site-id`]))}`,pathParams:{"cf1-site-id":String(r[`cf1-site-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
38
- `);return}a(await s(`Deleting`,async()=>c.magicTransit.cf1Sites.delete({account_id:l,cf1_site_id:r[`cf1-site-id`]})),{successLabel:`Deleted`})}};function wn(e){return e.positional(`cf1-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 Tn={command:`get <cf1-site-id>`,describe:`Gets a specific CF1 Site for an account.`,builder:wn,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit cf1-sites get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/cf1_sites/${r[`cf1-site-id`]==null?`<cf1-site-id>`:encodeURIComponent(String(r[`cf1-site-id`]))}`,pathParams:{"cf1-site-id":String(r[`cf1-site-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.magicTransit.cf1Sites.get({account_id:l,cf1_site_id:r[`cf1-site-id`]})),{successLabel:`Loaded`})}};function En(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Dn={command:`list`,describe:`Lists CF1 Sites associated with an account. A CF1 Site represents a physical customer network location with optional geographic coordinates.`,builder:En,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit cf1-sites list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/cf1_sites`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.magicTransit.cf1Sites.list({account_id:l})),{successLabel:`Loaded`})}};function On(e){return e.positional(`cf1-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(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const kn={command:`create <cf1-site-id>`,describe:`Creates ramps (network connections) for a CF1 Site.`,builder:On,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit cf1-sites ramps create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/cf1_sites/${r[`cf1-site-id`]==null?`<cf1-site-id>`:encodeURIComponent(String(r[`cf1-site-id`]))}/ramps`,pathParams:{"cf1-site-id":String(r[`cf1-site-id`]??``)},bodyKind:`json`,body:r.body===void 0?void 0:c(r.body)});return}let l=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.magicTransit.cf1Sites.ramps.create({body:e,account_id:u,cf1_site_id:r[`cf1-site-id`]})),{successLabel:`Created`});return}if(r.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function An(e){return e.positional(`ramp-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`cf1-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 jn={command:`delete <ramp-id>`,describe:`Deletes a specific ramp from a CF1 Site.`,builder:An,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit cf1-sites ramps delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/cf1_sites/${r[`cf1-site-id`]==null?`<cf1-site-id>`:encodeURIComponent(String(r[`cf1-site-id`]))}/ramps/${r[`ramp-id`]==null?`<ramp-id>`:encodeURIComponent(String(r[`ramp-id`]))}`,pathParams:{"cf1-site-id":String(r[`cf1-site-id`]??``),"ramp-id":String(r[`ramp-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
39
- `);return}a(await s(`Deleting`,async()=>c.magicTransit.cf1Sites.ramps.delete({account_id:l,cf1_site_id:r[`cf1-site-id`],ramp_id:r[`ramp-id`]})),{successLabel:`Deleted`})}};function Mn(e){return e.positional(`ramp-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`cf1-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 Nn={command:`get <ramp-id>`,describe:`Gets a specific ramp for a CF1 Site.`,builder:Mn,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit cf1-sites ramps get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/cf1_sites/${r[`cf1-site-id`]==null?`<cf1-site-id>`:encodeURIComponent(String(r[`cf1-site-id`]))}/ramps/${r[`ramp-id`]==null?`<ramp-id>`:encodeURIComponent(String(r[`ramp-id`]))}`,pathParams:{"cf1-site-id":String(r[`cf1-site-id`]??``),"ramp-id":String(r[`ramp-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.magicTransit.cf1Sites.ramps.get({account_id:l,cf1_site_id:r[`cf1-site-id`],ramp_id:r[`ramp-id`]})),{successLabel:`Loaded`})}};function Pn(e){return e.option(`cf1-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 Fn={command:`list`,describe:`Lists ramps (network connections) associated with a CF1 Site. Ramps represent GRE tunnels, IPsec tunnels, interconnects, or MCONN links.`,builder:Pn,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit cf1-sites ramps list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/cf1_sites/${r[`cf1-site-id`]==null?`<cf1-site-id>`:encodeURIComponent(String(r[`cf1-site-id`]))}/ramps`,pathParams:{"cf1-site-id":String(r[`cf1-site-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.magicTransit.cf1Sites.ramps.list({account_id:l,cf1_site_id:r[`cf1-site-id`]})),{successLabel:`Loaded`})}},$={command:`ramps`,describe:`Operations for cf1-sites.ramps`,builder:e=>e.command(kn).command(jn).command(Nn).command(Fn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function In(e){return e.positional(`cf1-site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`description`,{type:`string`,description:`A human-provided description of the CF1 Site.`}).option(`location-lat`,{type:`number`,description:`Latitude of the CF1 Site.`}).option(`location-long`,{type:`number`,description:`Longitude of the CF1 Site.`}).option(`location-name`,{type:`string`,description:`Name of nearest town, city, or village.`}).option(`name`,{type:`string`,description:`A human-provided name describing the CF1 Site that should be unique within the account.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Partial update payload for a CF1 Site. All properties are optional; only fields supplied in the request body are modified.`})}const Ln={command:`update <cf1-site-id>`,describe:`Partially updates a specific CF1 Site for an account. Only the fields included in the request body are modified; omitted fields retain their existing values.`,builder:In,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit cf1-sites update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/cf1_sites/${r[`cf1-site-id`]==null?`<cf1-site-id>`:encodeURIComponent(String(r[`cf1-site-id`]))}`,pathParams:{"cf1-site-id":String(r[`cf1-site-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({description:d(r.description,`description`,`text`),location:{lat:r[`location-lat`],long:r[`location-long`],name:d(r[`location-name`],`location-name`,`text`)},name:d(r.name,`name`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.magicTransit.cf1Sites.update({...e,account_id:f,cf1_site_id:r[`cf1-site-id`]})),{successLabel:`Updated`});return}let p=u({description:d(r.description,`description`,`text`),location:{lat:r[`location-lat`],long:r[`location-long`],name:d(r[`location-name`],`location-name`,`text`)},name:d(r.name,`name`,`text`)});a(await s(`Updating`,async()=>l.magicTransit.cf1Sites.update({...p,account_id:f,cf1_site_id:r[`cf1-site-id`]})),{successLabel:`Updated`})}},Rn={command:`cf1-sites`,describe:`Operations for cf1-sites`,builder:e=>e.command(xn).command(Cn).command(Tn).command(Dn).command(Ln).command($).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function zn(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 Bn={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:zn,handler:async l=>{let u={};if(l[`x-magic-new-hc-target`]!==void 0&&(u[`x-magic-new-hc-target`]=String(l[`x-magic-new-hc-target`])),l.dryRun){o({command:`cf magic-transit gre-tunnels bulk-update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/gre_tunnels`,pathParams:{},bodyKind:`json`,body:l.body===void 0?void 0:c(l.body)});return}let d=await i(l),f=l.local?e:await t();if(l.accountId=f,l.body){let e=c(l.body);a(await s(`Updating`,async()=>r(d,`PUT`,`/accounts/${f}/magic/gre_tunnels`,{body:e,headers:Object.keys(u).length>0?u:void 0})),{successLabel:`Updated`});return}a(await s(`Updating`,async()=>r(d,`PUT`,`/accounts/${f}/magic/gre_tunnels`,{headers:Object.keys(u).length>0?u:void 0})),{successLabel:`Updated`})}};function Vn(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.
40
-
41
- Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the
42
- key is not treated as a secret value. This is *only* supported for preventing
43
- misconfiguration, not for defending against malicious attacks.
44
-
45
- The MD5 key, if set, must be of non-zero length and consist only of the following types of
46
- character:
47
-
48
- * ASCII alphanumerics: \`[a-zA-Z0-9]\`
49
- * Special characters in the set \`'!@#$%^&*()+[]{}<>/.,;:_-~\`= \\|\`
50
-
51
- In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A),
52
- quotation mark (\`"\`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed
53
- (0x0C), and the question mark (\`?\`). Requests specifying an MD5 key with one or more of
54
- 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 Hn={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:Vn,handler:async p=>{let m={};if(p[`x-magic-new-hc-target`]!==void 0&&(m[`x-magic-new-hc-target`]=String(p[`x-magic-new-hc-target`])),p.dryRun){o({command:`cf magic-transit gre-tunnels create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/gre_tunnels`,pathParams:{},bodyKind:`json`,body:p.body===void 0?u({automatic_return_routing:p[`automatic-return-routing`],bgp:{customer_asn:p[`bgp-customer-asn`],export_filter_id:d(p[`bgp-export-filter-id`],`bgp-export-filter-id`,`text`),extra_prefixes:p[`bgp-extra-prefixes`],import_filter_id:d(p[`bgp-import-filter-id`],`bgp-import-filter-id`,`text`),md5_key:d(p[`bgp-md5-key`],`bgp-md5-key`,`text`)},cloudflare_gre_endpoint:d(p[`cloudflare-gre-endpoint`],`cloudflare-gre-endpoint`,`text`),customer_gre_endpoint:d(p[`customer-gre-endpoint`],`customer-gre-endpoint`,`text`),description:d(p.description,`description`,`text`),health_check:{enabled:p[`health-check-enabled`],rate:d(p[`health-check-rate`],`health-check-rate`,`text`),target:{saved:d(p[`health-check-target-saved`],`health-check-target-saved`,`text`)},type:d(p[`health-check-type`],`health-check-type`,`text`),direction:d(p[`health-check-direction`],`health-check-direction`,`text`)},interface_address:d(p[`interface-address`],`interface-address`,`text`),interface_address6:d(p[`interface-address6`],`interface-address6`,`text`),mtu:p.mtu,name:d(p.name,`name`,`text`),ttl:p.ttl}):c(p.body)});return}let h=await i(p),g=p.local?e:await t();if(p.accountId=g,p.body){let e=c(p.body);a(await s(`Creating`,async()=>r(h,`POST`,`/accounts/${g}/magic/gre_tunnels`,{body:e,headers:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`});return}p[`cloudflare-gre-endpoint`]===void 0&&(p[`cloudflare-gre-endpoint`]=await f(`cloudflare-gre-endpoint`,`The IP address assigned to the Cloudflare side of the GRE tunnel.`)),p[`customer-gre-endpoint`]===void 0&&(p[`customer-gre-endpoint`]=await f(`customer-gre-endpoint`,`The IP address assigned to the customer side of the GRE tunnel.`)),p[`interface-address`]===void 0&&(p[`interface-address`]=await f(`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.`)),p.name===void 0&&(p.name=await f(`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 _={};p[`automatic-return-routing`]!==void 0&&l(_,[`automatic_return_routing`],p[`automatic-return-routing`]),p[`bgp-customer-asn`]!==void 0&&l(_,[`bgp`,`customer_asn`],p[`bgp-customer-asn`]),p[`bgp-export-filter-id`]!==void 0&&l(_,[`bgp`,`export_filter_id`],d(p[`bgp-export-filter-id`],`bgp-export-filter-id`,`text`)),p[`bgp-extra-prefixes`]!==void 0&&l(_,[`bgp`,`extra_prefixes`],p[`bgp-extra-prefixes`]),p[`bgp-import-filter-id`]!==void 0&&l(_,[`bgp`,`import_filter_id`],d(p[`bgp-import-filter-id`],`bgp-import-filter-id`,`text`)),p[`bgp-md5-key`]!==void 0&&l(_,[`bgp`,`md5_key`],d(p[`bgp-md5-key`],`bgp-md5-key`,`text`)),p[`cloudflare-gre-endpoint`]!==void 0&&l(_,[`cloudflare_gre_endpoint`],d(p[`cloudflare-gre-endpoint`],`cloudflare-gre-endpoint`,`text`)),p[`customer-gre-endpoint`]!==void 0&&l(_,[`customer_gre_endpoint`],d(p[`customer-gre-endpoint`],`customer-gre-endpoint`,`text`)),p.description!==void 0&&l(_,[`description`],d(p.description,`description`,`text`)),p[`health-check-enabled`]!==void 0&&l(_,[`health_check`,`enabled`],p[`health-check-enabled`]),p[`health-check-rate`]!==void 0&&l(_,[`health_check`,`rate`],d(p[`health-check-rate`],`health-check-rate`,`text`)),p[`health-check-target-saved`]!==void 0&&l(_,[`health_check`,`target`,`saved`],d(p[`health-check-target-saved`],`health-check-target-saved`,`text`)),p[`health-check-type`]!==void 0&&l(_,[`health_check`,`type`],d(p[`health-check-type`],`health-check-type`,`text`)),p[`health-check-direction`]!==void 0&&l(_,[`health_check`,`direction`],d(p[`health-check-direction`],`health-check-direction`,`text`)),p[`interface-address`]!==void 0&&l(_,[`interface_address`],d(p[`interface-address`],`interface-address`,`text`)),p[`interface-address6`]!==void 0&&l(_,[`interface_address6`],d(p[`interface-address6`],`interface-address6`,`text`)),p.mtu!==void 0&&l(_,[`mtu`],p.mtu),p.name!==void 0&&l(_,[`name`],d(p.name,`name`,`text`)),p.ttl!==void 0&&l(_,[`ttl`],p.ttl),a(await s(`Creating`,async()=>r(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 Un(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 Wn={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:Un,handler:async c=>{let l={};if(c[`x-magic-new-hc-target`]!==void 0&&(l[`x-magic-new-hc-target`]=String(c[`x-magic-new-hc-target`])),c.dryRun){o({command:`cf magic-transit gre-tunnels delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/gre_tunnels/${c[`gre-tunnel-id`]==null?`<gre-tunnel-id>`:encodeURIComponent(String(c[`gre-tunnel-id`]))}`,pathParams:{"gre-tunnel-id":String(c[`gre-tunnel-id`]??``)},bodyKind:`none`});return}let u=await i(c),d=c.local?e:await t();if(c.accountId=d,!await m({force:!!c.force})){process.stderr.write(`Aborted.
55
- `);return}a(await s(`Deleting`,async()=>r(u,`DELETE`,`/accounts/${d}/magic/gre_tunnels/${encodeURIComponent(String(c[`gre-tunnel-id`]))}`,{headers:Object.keys(l).length>0?l:void 0})),{successLabel:`Deleted`})}};function Gn(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 Kn={command:`get <gre-tunnel-id>`,describe:`Lists informtion for a specific GRE tunnel.`,builder:Gn,handler:async c=>{let l={};if(c[`x-magic-new-hc-target`]!==void 0&&(l[`x-magic-new-hc-target`]=String(c[`x-magic-new-hc-target`])),c.dryRun){o({command:`cf magic-transit gre-tunnels get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/gre_tunnels/${c[`gre-tunnel-id`]==null?`<gre-tunnel-id>`:encodeURIComponent(String(c[`gre-tunnel-id`]))}`,pathParams:{"gre-tunnel-id":String(c[`gre-tunnel-id`]??``)},bodyKind:`none`});return}let u=await i(c),d=c.local?e:await t();c.accountId=d,a(await s(`Loading`,async()=>r(u,`GET`,`/accounts/${d}/magic/gre_tunnels/${encodeURIComponent(String(c[`gre-tunnel-id`]))}`,{headers:Object.keys(l).length>0?l:void 0})),{successLabel:`Loaded`})}};function qn(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 Jn={command:`list`,describe:`Lists GRE tunnels associated with an account.`,builder:qn,handler:async c=>{let l={};if(c[`x-magic-new-hc-target`]!==void 0&&(l[`x-magic-new-hc-target`]=String(c[`x-magic-new-hc-target`])),c.dryRun){o({command:`cf magic-transit gre-tunnels list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/gre_tunnels`,pathParams:{},bodyKind:`none`});return}let u=await i(c),d=c.local?e:await t();c.accountId=d,a(await s(`Loading`,async()=>r(u,`GET`,`/accounts/${d}/magic/gre_tunnels`,{headers:Object.keys(l).length>0?l:void 0})),{successLabel:`Loaded`})}};function Yn(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 Xn={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:Yn,handler:async p=>{let m={};if(p[`x-magic-new-hc-target`]!==void 0&&(m[`x-magic-new-hc-target`]=String(p[`x-magic-new-hc-target`])),p.dryRun){o({command:`cf magic-transit gre-tunnels update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/gre_tunnels/${p[`gre-tunnel-id`]==null?`<gre-tunnel-id>`:encodeURIComponent(String(p[`gre-tunnel-id`]))}`,pathParams:{"gre-tunnel-id":String(p[`gre-tunnel-id`]??``)},bodyKind:`json`,body:p.body===void 0?u({automatic_return_routing:p[`automatic-return-routing`],cloudflare_gre_endpoint:d(p[`cloudflare-gre-endpoint`],`cloudflare-gre-endpoint`,`text`),customer_gre_endpoint:d(p[`customer-gre-endpoint`],`customer-gre-endpoint`,`text`),description:d(p.description,`description`,`text`),health_check:{enabled:p[`health-check-enabled`],rate:d(p[`health-check-rate`],`health-check-rate`,`text`),target:{saved:d(p[`health-check-target-saved`],`health-check-target-saved`,`text`)},type:d(p[`health-check-type`],`health-check-type`,`text`),direction:d(p[`health-check-direction`],`health-check-direction`,`text`)},interface_address:d(p[`interface-address`],`interface-address`,`text`),interface_address6:d(p[`interface-address6`],`interface-address6`,`text`),mtu:p.mtu,name:d(p.name,`name`,`text`),ttl:p.ttl}):c(p.body)});return}let h=await i(p),g=p.local?e:await t();if(p.accountId=g,p.body){let e=c(p.body);a(await s(`Updating`,async()=>r(h,`PUT`,`/accounts/${g}/magic/gre_tunnels/${encodeURIComponent(String(p[`gre-tunnel-id`]))}`,{body:e,headers:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated`});return}p[`cloudflare-gre-endpoint`]===void 0&&(p[`cloudflare-gre-endpoint`]=await f(`cloudflare-gre-endpoint`,`The IP address assigned to the Cloudflare side of the GRE tunnel.`)),p[`customer-gre-endpoint`]===void 0&&(p[`customer-gre-endpoint`]=await f(`customer-gre-endpoint`,`The IP address assigned to the customer side of the GRE tunnel.`)),p[`interface-address`]===void 0&&(p[`interface-address`]=await f(`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.`)),p.name===void 0&&(p.name=await f(`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 _={};p[`automatic-return-routing`]!==void 0&&l(_,[`automatic_return_routing`],p[`automatic-return-routing`]),p[`cloudflare-gre-endpoint`]!==void 0&&l(_,[`cloudflare_gre_endpoint`],d(p[`cloudflare-gre-endpoint`],`cloudflare-gre-endpoint`,`text`)),p[`customer-gre-endpoint`]!==void 0&&l(_,[`customer_gre_endpoint`],d(p[`customer-gre-endpoint`],`customer-gre-endpoint`,`text`)),p.description!==void 0&&l(_,[`description`],d(p.description,`description`,`text`)),p[`health-check-enabled`]!==void 0&&l(_,[`health_check`,`enabled`],p[`health-check-enabled`]),p[`health-check-rate`]!==void 0&&l(_,[`health_check`,`rate`],d(p[`health-check-rate`],`health-check-rate`,`text`)),p[`health-check-target-saved`]!==void 0&&l(_,[`health_check`,`target`,`saved`],d(p[`health-check-target-saved`],`health-check-target-saved`,`text`)),p[`health-check-type`]!==void 0&&l(_,[`health_check`,`type`],d(p[`health-check-type`],`health-check-type`,`text`)),p[`health-check-direction`]!==void 0&&l(_,[`health_check`,`direction`],d(p[`health-check-direction`],`health-check-direction`,`text`)),p[`interface-address`]!==void 0&&l(_,[`interface_address`],d(p[`interface-address`],`interface-address`,`text`)),p[`interface-address6`]!==void 0&&l(_,[`interface_address6`],d(p[`interface-address6`],`interface-address6`,`text`)),p.mtu!==void 0&&l(_,[`mtu`],p.mtu),p.name!==void 0&&l(_,[`name`],d(p.name,`name`,`text`)),p.ttl!==void 0&&l(_,[`ttl`],p.ttl),a(await s(`Updating`,async()=>r(h,`PUT`,`/accounts/${g}/magic/gre_tunnels/${encodeURIComponent(String(p[`gre-tunnel-id`]))}`,{body:Object.keys(_).length>0?_:void 0,headers:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated`})}},Zn={command:`gre-tunnels`,describe:`GRE tunnel endpoints that connect your network to Cloudflare for Magic Transit`,builder:e=>e.command(Bn).command(Hn).command(Wn).command(Kn).command(Jn).command(Xn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Qn(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 $n={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:Qn,handler:async l=>{let u={};if(l[`x-magic-new-hc-target`]!==void 0&&(u[`x-magic-new-hc-target`]=String(l[`x-magic-new-hc-target`])),l.dryRun){o({command:`cf magic-transit ipsec-tunnels bulk-update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/ipsec_tunnels`,pathParams:{},bodyKind:`json`,body:l.body===void 0?void 0:c(l.body)});return}let d=await i(l),f=l.local?e:await t();if(l.accountId=f,l.body){let e=c(l.body);a(await s(`Updating`,async()=>r(d,`PUT`,`/accounts/${f}/magic/ipsec_tunnels`,{body:e,headers:Object.keys(u).length>0?u:void 0})),{successLabel:`Updated`});return}a(await s(`Updating`,async()=>r(d,`PUT`,`/accounts/${f}/magic/ipsec_tunnels`,{headers:Object.keys(u).length>0?u:void 0})),{successLabel:`Updated`})}};function er(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.
56
-
57
- Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the
58
- key is not treated as a secret value. This is *only* supported for preventing
59
- misconfiguration, not for defending against malicious attacks.
60
-
61
- The MD5 key, if set, must be of non-zero length and consist only of the following types of
62
- character:
63
-
64
- * ASCII alphanumerics: \`[a-zA-Z0-9]\`
65
- * Special characters in the set \`'!@#$%^&*()+[]{}<>/.,;:_-~\`= \\|\`
66
-
67
- In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A),
68
- quotation mark (\`"\`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed
69
- (0x0C), and the question mark (\`?\`). Requests specifying an MD5 key with one or more of
70
- 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
71
- generated IKE IDs can still be used even if this custom value is specified.
72
-
73
- Must be of the form \`<custom label>.<account ID>.custom.ipsec.cloudflare.com\`.
74
-
75
- This custom ID does not need to be unique. Two IPsec tunnels may have the same custom
76
- fqdn_id. However, if another IPsec tunnel has the same value then the two tunnels
77
- 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 tr={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:er,handler:async p=>{let m={};if(p[`x-magic-new-hc-target`]!==void 0&&(m[`x-magic-new-hc-target`]=String(p[`x-magic-new-hc-target`])),p.dryRun){o({command:`cf magic-transit ipsec-tunnels create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/ipsec_tunnels`,pathParams:{},bodyKind:`json`,body:p.body===void 0?u({automatic_return_routing:p[`automatic-return-routing`],bgp:{customer_asn:p[`bgp-customer-asn`],export_filter_id:d(p[`bgp-export-filter-id`],`bgp-export-filter-id`,`text`),extra_prefixes:p[`bgp-extra-prefixes`],import_filter_id:d(p[`bgp-import-filter-id`],`bgp-import-filter-id`,`text`),md5_key:d(p[`bgp-md5-key`],`bgp-md5-key`,`text`)},cloudflare_endpoint:d(p[`cloudflare-endpoint`],`cloudflare-endpoint`,`text`),custom_remote_identities:{fqdn_id:d(p[`custom-remote-identities-fqdn-id`],`custom-remote-identities-fqdn-id`,`text`)},customer_endpoint:d(p[`customer-endpoint`],`customer-endpoint`,`text`),description:d(p.description,`description`,`text`),health_check:{enabled:p[`health-check-enabled`],rate:d(p[`health-check-rate`],`health-check-rate`,`text`),target:{saved:d(p[`health-check-target-saved`],`health-check-target-saved`,`text`)},type:d(p[`health-check-type`],`health-check-type`,`text`),direction:d(p[`health-check-direction`],`health-check-direction`,`text`)},interface_address:d(p[`interface-address`],`interface-address`,`text`),interface_address6:d(p[`interface-address6`],`interface-address6`,`text`),name:d(p.name,`name`,`text`),psk:d(p.psk,`psk`,`text`),replay_protection:p[`replay-protection`]}):c(p.body)});return}let h=await i(p),g=p.local?e:await t();if(p.accountId=g,p.body){let e=c(p.body);a(await s(`Creating`,async()=>r(h,`POST`,`/accounts/${g}/magic/ipsec_tunnels`,{body:e,headers:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`});return}p[`cloudflare-endpoint`]===void 0&&(p[`cloudflare-endpoint`]=await f(`cloudflare-endpoint`,`The IP address assigned to the Cloudflare side of the IPsec tunnel.`)),p[`interface-address`]===void 0&&(p[`interface-address`]=await f(`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.`)),p.name===void 0&&(p.name=await f(`name`,`The name of the IPsec tunnel. The name cannot share a name with other tunnels.`));let _={};p[`automatic-return-routing`]!==void 0&&l(_,[`automatic_return_routing`],p[`automatic-return-routing`]),p[`bgp-customer-asn`]!==void 0&&l(_,[`bgp`,`customer_asn`],p[`bgp-customer-asn`]),p[`bgp-export-filter-id`]!==void 0&&l(_,[`bgp`,`export_filter_id`],d(p[`bgp-export-filter-id`],`bgp-export-filter-id`,`text`)),p[`bgp-extra-prefixes`]!==void 0&&l(_,[`bgp`,`extra_prefixes`],p[`bgp-extra-prefixes`]),p[`bgp-import-filter-id`]!==void 0&&l(_,[`bgp`,`import_filter_id`],d(p[`bgp-import-filter-id`],`bgp-import-filter-id`,`text`)),p[`bgp-md5-key`]!==void 0&&l(_,[`bgp`,`md5_key`],d(p[`bgp-md5-key`],`bgp-md5-key`,`text`)),p[`cloudflare-endpoint`]!==void 0&&l(_,[`cloudflare_endpoint`],d(p[`cloudflare-endpoint`],`cloudflare-endpoint`,`text`)),p[`custom-remote-identities-fqdn-id`]!==void 0&&l(_,[`custom_remote_identities`,`fqdn_id`],d(p[`custom-remote-identities-fqdn-id`],`custom-remote-identities-fqdn-id`,`text`)),p[`customer-endpoint`]!==void 0&&l(_,[`customer_endpoint`],d(p[`customer-endpoint`],`customer-endpoint`,`text`)),p.description!==void 0&&l(_,[`description`],d(p.description,`description`,`text`)),p[`health-check-enabled`]!==void 0&&l(_,[`health_check`,`enabled`],p[`health-check-enabled`]),p[`health-check-rate`]!==void 0&&l(_,[`health_check`,`rate`],d(p[`health-check-rate`],`health-check-rate`,`text`)),p[`health-check-target-saved`]!==void 0&&l(_,[`health_check`,`target`,`saved`],d(p[`health-check-target-saved`],`health-check-target-saved`,`text`)),p[`health-check-type`]!==void 0&&l(_,[`health_check`,`type`],d(p[`health-check-type`],`health-check-type`,`text`)),p[`health-check-direction`]!==void 0&&l(_,[`health_check`,`direction`],d(p[`health-check-direction`],`health-check-direction`,`text`)),p[`interface-address`]!==void 0&&l(_,[`interface_address`],d(p[`interface-address`],`interface-address`,`text`)),p[`interface-address6`]!==void 0&&l(_,[`interface_address6`],d(p[`interface-address6`],`interface-address6`,`text`)),p.name!==void 0&&l(_,[`name`],d(p.name,`name`,`text`)),p.psk!==void 0&&l(_,[`psk`],d(p.psk,`psk`,`text`)),p[`replay-protection`]!==void 0&&l(_,[`replay_protection`],p[`replay-protection`]),a(await s(`Creating`,async()=>r(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 nr(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 rr={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:nr,handler:async c=>{let l={};if(c[`x-magic-new-hc-target`]!==void 0&&(l[`x-magic-new-hc-target`]=String(c[`x-magic-new-hc-target`])),c.dryRun){o({command:`cf magic-transit ipsec-tunnels delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/ipsec_tunnels/${c[`ipsec-tunnel-id`]==null?`<ipsec-tunnel-id>`:encodeURIComponent(String(c[`ipsec-tunnel-id`]))}`,pathParams:{"ipsec-tunnel-id":String(c[`ipsec-tunnel-id`]??``)},bodyKind:`none`});return}let u=await i(c),d=c.local?e:await t();if(c.accountId=d,!await m({force:!!c.force})){process.stderr.write(`Aborted.
78
- `);return}a(await s(`Deleting`,async()=>r(u,`DELETE`,`/accounts/${d}/magic/ipsec_tunnels/${encodeURIComponent(String(c[`ipsec-tunnel-id`]))}`,{headers:Object.keys(l).length>0?l:void 0})),{successLabel:`Deleted`})}};function ir(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 ar={command:`get <ipsec-tunnel-id>`,describe:`Lists details for a specific IPsec tunnel.`,builder:ir,handler:async c=>{let l={};if(c[`x-magic-new-hc-target`]!==void 0&&(l[`x-magic-new-hc-target`]=String(c[`x-magic-new-hc-target`])),c.dryRun){o({command:`cf magic-transit ipsec-tunnels get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/ipsec_tunnels/${c[`ipsec-tunnel-id`]==null?`<ipsec-tunnel-id>`:encodeURIComponent(String(c[`ipsec-tunnel-id`]))}`,pathParams:{"ipsec-tunnel-id":String(c[`ipsec-tunnel-id`]??``)},bodyKind:`none`});return}let u=await i(c),d=c.local?e:await t();c.accountId=d,a(await s(`Loading`,async()=>r(u,`GET`,`/accounts/${d}/magic/ipsec_tunnels/${encodeURIComponent(String(c[`ipsec-tunnel-id`]))}`,{headers:Object.keys(l).length>0?l:void 0})),{successLabel:`Loaded`})}};function or(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 sr={command:`list`,describe:`Lists IPsec tunnels associated with an account.`,builder:or,handler:async c=>{let l={};if(c[`x-magic-new-hc-target`]!==void 0&&(l[`x-magic-new-hc-target`]=String(c[`x-magic-new-hc-target`])),c.dryRun){o({command:`cf magic-transit ipsec-tunnels list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/ipsec_tunnels`,pathParams:{},bodyKind:`none`});return}let u=await i(c),d=c.local?e:await t();c.accountId=d,a(await s(`Loading`,async()=>r(u,`GET`,`/accounts/${d}/magic/ipsec_tunnels`,{headers:Object.keys(l).length>0?l:void 0})),{successLabel:`Loaded`})}};function cr(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 lr={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:cr,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit ipsec-tunnels psk-generate`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/ipsec_tunnels/${r[`ipsec-tunnel-id`]==null?`<ipsec-tunnel-id>`:encodeURIComponent(String(r[`ipsec-tunnel-id`]))}/psk_generate`,pathParams:{"ipsec-tunnel-id":String(r[`ipsec-tunnel-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Creating`,async()=>c.magicTransit.ipsecTunnels.pskGenerate({account_id:l,ipsec_tunnel_id:r[`ipsec-tunnel-id`]})),{successLabel:`Created`})}};function ur(e){return e.option(`validate-only`,{type:`boolean`,description:"If `true`, only run validation without persisting changes."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Request body for setting PSKs for multiple IPsec tunnels.`})}const dr={command:`psk-set`,describe:"Sets Pre-Shared Keys for multiple IPsec tunnels associated with an account. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes. After PSKs are applied, they are immediately persisted to Cloudflare's edge and cannot be retrieved later. Store the PSKs in a safe place.",builder:ur,handler:async r=>{let l={validate_only:r[`validate-only`]};if(r.dryRun){o({command:`cf magic-transit ipsec-tunnels psk-set`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/ipsec_tunnels/psk`,pathParams:{},query:l,bodyKind:`json`,body:r.body===void 0?void 0:c(r.body)});return}let u=await i(r),d=r.local?e:await t();if(r.accountId=d,r.body){let e=c(r.body);new URLSearchParams(Object.entries(l).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),a(await s(`Creating`,async()=>u.magicTransit.ipsecTunnels.pskSet({...e,account_id:d,...l})),{successLabel:`Created`});return}if(r.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function fr(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.
79
-
80
- Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the
81
- key is not treated as a secret value. This is *only* supported for preventing
82
- misconfiguration, not for defending against malicious attacks.
83
-
84
- The MD5 key, if set, must be of non-zero length and consist only of the following types of
85
- character:
86
-
87
- * ASCII alphanumerics: \`[a-zA-Z0-9]\`
88
- * Special characters in the set \`'!@#$%^&*()+[]{}<>/.,;:_-~\`= \\|\`
89
-
90
- In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A),
91
- quotation mark (\`"\`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed
92
- (0x0C), and the question mark (\`?\`). Requests specifying an MD5 key with one or more of
93
- 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
94
- generated IKE IDs can still be used even if this custom value is specified.
95
-
96
- Must be of the form \`<custom label>.<account ID>.custom.ipsec.cloudflare.com\`.
97
-
98
- This custom ID does not need to be unique. Two IPsec tunnels may have the same custom
99
- fqdn_id. However, if another IPsec tunnel has the same value then the two tunnels
100
- 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 pr={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:fr,handler:async p=>{let m={};if(p[`x-magic-new-hc-target`]!==void 0&&(m[`x-magic-new-hc-target`]=String(p[`x-magic-new-hc-target`])),p.dryRun){o({command:`cf magic-transit ipsec-tunnels update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/ipsec_tunnels/${p[`ipsec-tunnel-id`]==null?`<ipsec-tunnel-id>`:encodeURIComponent(String(p[`ipsec-tunnel-id`]))}`,pathParams:{"ipsec-tunnel-id":String(p[`ipsec-tunnel-id`]??``)},bodyKind:`json`,body:p.body===void 0?u({automatic_return_routing:p[`automatic-return-routing`],bgp:{customer_asn:p[`bgp-customer-asn`],export_filter_id:d(p[`bgp-export-filter-id`],`bgp-export-filter-id`,`text`),extra_prefixes:p[`bgp-extra-prefixes`],import_filter_id:d(p[`bgp-import-filter-id`],`bgp-import-filter-id`,`text`),md5_key:d(p[`bgp-md5-key`],`bgp-md5-key`,`text`)},cloudflare_endpoint:d(p[`cloudflare-endpoint`],`cloudflare-endpoint`,`text`),custom_remote_identities:{fqdn_id:d(p[`custom-remote-identities-fqdn-id`],`custom-remote-identities-fqdn-id`,`text`)},customer_endpoint:d(p[`customer-endpoint`],`customer-endpoint`,`text`),description:d(p.description,`description`,`text`),health_check:{enabled:p[`health-check-enabled`],rate:d(p[`health-check-rate`],`health-check-rate`,`text`),target:{saved:d(p[`health-check-target-saved`],`health-check-target-saved`,`text`)},type:d(p[`health-check-type`],`health-check-type`,`text`),direction:d(p[`health-check-direction`],`health-check-direction`,`text`)},interface_address:d(p[`interface-address`],`interface-address`,`text`),interface_address6:d(p[`interface-address6`],`interface-address6`,`text`),name:d(p.name,`name`,`text`),psk:d(p.psk,`psk`,`text`),replay_protection:p[`replay-protection`]}):c(p.body)});return}let h=await i(p),g=p.local?e:await t();if(p.accountId=g,p.body){let e=c(p.body);a(await s(`Updating`,async()=>r(h,`PUT`,`/accounts/${g}/magic/ipsec_tunnels/${encodeURIComponent(String(p[`ipsec-tunnel-id`]))}`,{body:e,headers:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated`});return}p[`cloudflare-endpoint`]===void 0&&(p[`cloudflare-endpoint`]=await f(`cloudflare-endpoint`,`The IP address assigned to the Cloudflare side of the IPsec tunnel.`)),p[`interface-address`]===void 0&&(p[`interface-address`]=await f(`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.`)),p.name===void 0&&(p.name=await f(`name`,`The name of the IPsec tunnel. The name cannot share a name with other tunnels.`));let _={};p[`automatic-return-routing`]!==void 0&&l(_,[`automatic_return_routing`],p[`automatic-return-routing`]),p[`bgp-customer-asn`]!==void 0&&l(_,[`bgp`,`customer_asn`],p[`bgp-customer-asn`]),p[`bgp-export-filter-id`]!==void 0&&l(_,[`bgp`,`export_filter_id`],d(p[`bgp-export-filter-id`],`bgp-export-filter-id`,`text`)),p[`bgp-extra-prefixes`]!==void 0&&l(_,[`bgp`,`extra_prefixes`],p[`bgp-extra-prefixes`]),p[`bgp-import-filter-id`]!==void 0&&l(_,[`bgp`,`import_filter_id`],d(p[`bgp-import-filter-id`],`bgp-import-filter-id`,`text`)),p[`bgp-md5-key`]!==void 0&&l(_,[`bgp`,`md5_key`],d(p[`bgp-md5-key`],`bgp-md5-key`,`text`)),p[`cloudflare-endpoint`]!==void 0&&l(_,[`cloudflare_endpoint`],d(p[`cloudflare-endpoint`],`cloudflare-endpoint`,`text`)),p[`custom-remote-identities-fqdn-id`]!==void 0&&l(_,[`custom_remote_identities`,`fqdn_id`],d(p[`custom-remote-identities-fqdn-id`],`custom-remote-identities-fqdn-id`,`text`)),p[`customer-endpoint`]!==void 0&&l(_,[`customer_endpoint`],d(p[`customer-endpoint`],`customer-endpoint`,`text`)),p.description!==void 0&&l(_,[`description`],d(p.description,`description`,`text`)),p[`health-check-enabled`]!==void 0&&l(_,[`health_check`,`enabled`],p[`health-check-enabled`]),p[`health-check-rate`]!==void 0&&l(_,[`health_check`,`rate`],d(p[`health-check-rate`],`health-check-rate`,`text`)),p[`health-check-target-saved`]!==void 0&&l(_,[`health_check`,`target`,`saved`],d(p[`health-check-target-saved`],`health-check-target-saved`,`text`)),p[`health-check-type`]!==void 0&&l(_,[`health_check`,`type`],d(p[`health-check-type`],`health-check-type`,`text`)),p[`health-check-direction`]!==void 0&&l(_,[`health_check`,`direction`],d(p[`health-check-direction`],`health-check-direction`,`text`)),p[`interface-address`]!==void 0&&l(_,[`interface_address`],d(p[`interface-address`],`interface-address`,`text`)),p[`interface-address6`]!==void 0&&l(_,[`interface_address6`],d(p[`interface-address6`],`interface-address6`,`text`)),p.name!==void 0&&l(_,[`name`],d(p.name,`name`,`text`)),p.psk!==void 0&&l(_,[`psk`],d(p.psk,`psk`,`text`)),p[`replay-protection`]!==void 0&&l(_,[`replay_protection`],p[`replay-protection`]),a(await s(`Updating`,async()=>r(h,`PUT`,`/accounts/${g}/magic/ipsec_tunnels/${encodeURIComponent(String(p[`ipsec-tunnel-id`]))}`,{body:Object.keys(_).length>0?_:void 0,headers:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated`})}},mr={command:`ipsec-tunnels`,describe:`IPsec tunnel endpoints with pre-shared key management for encrypted transit`,builder:e=>e.command($n).command(tr).command(rr).command(ar).command(sr).command(lr).command(dr).command(pr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function hr(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 gr={command:`create`,describe:`Create new PCAP request for account.`,builder:hr,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit pcaps create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/pcaps`,pathParams:{},bodyKind:`json`,body:r.body===void 0?void 0:c(r.body)});return}let l=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.magicTransit.pcaps.create({body:e,account_id:u})),{successLabel:`Created`});return}if(r.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function _r(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 vr={command:`get <pcap-id>`,describe:`Download PCAP information into a file. Response is a binary PCAP file.`,builder:_r,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit pcaps download get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/pcaps/${r[`pcap-id`]==null?`<pcap-id>`:encodeURIComponent(String(r[`pcap-id`]))}/download`,pathParams:{"pcap-id":String(r[`pcap-id`]??``)},bodyKind:`none`});return}await i(r);let a=r.local?e:await t();r.accountId=a;let c=await s(`Loading`,async()=>g(`/accounts/${a}/pcaps/${encodeURIComponent(String(r[`pcap-id`]))}/download`,{method:`GET`,local:r.local===!0,persistTo:r.persistTo}));h(r.text===!0?c.toString(`utf-8`):c)}},yr={command:`download`,describe:`Operations for pcaps.download`,builder:e=>e.command(vr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function br(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 xr={command:`get <pcap-id>`,describe:`Get information for a PCAP request by id.`,builder:br,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit pcaps get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/pcaps/${r[`pcap-id`]==null?`<pcap-id>`:encodeURIComponent(String(r[`pcap-id`]))}`,pathParams:{"pcap-id":String(r[`pcap-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.magicTransit.pcaps.get({account_id:l,pcap_id:r[`pcap-id`]})),{successLabel:`Loaded`})}};function Sr(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Cr={command:`list`,describe:`Lists all packet capture requests for an account.`,builder:Sr,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit pcaps list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/pcaps`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.magicTransit.pcaps.list({account_id:l})),{successLabel:`Loaded`})}};function wr(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 Tr={command:`create`,describe:`Adds an AWS or GCP bucket to use with full packet captures.`,builder:wr,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit pcaps ownership create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/pcaps/ownership`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({destination_conf:d(r[`destination-conf`],`destination-conf`,`text`)}):c(r.body)});return}let l=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.magicTransit.pcaps.ownership.create({...e,account_id:p})),{successLabel:`Created`});return}r[`destination-conf`]===void 0&&(r[`destination-conf`]=await f(`destination-conf`,"The full URI for the bucket. This field only applies to `full` packet captures."));let m=u({destination_conf:d(r[`destination-conf`],`destination-conf`,`text`)});a(await s(`Creating`,async()=>l.magicTransit.pcaps.ownership.create({...m,account_id:p})),{successLabel:`Created`})}};function Er(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 Dr={command:`delete <ownership-id>`,describe:`Deletes buckets added to the packet captures API.`,builder:Er,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit pcaps ownership delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/pcaps/ownership/${r[`ownership-id`]==null?`<ownership-id>`:encodeURIComponent(String(r[`ownership-id`]))}`,pathParams:{"ownership-id":String(r[`ownership-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
101
- `);return}a(await s(`Deleting`,async()=>c.magicTransit.pcaps.ownership.delete({account_id:l,ownership_id:r[`ownership-id`]})),{successLabel:`Deleted`})}};function Or(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const kr={command:`get`,describe:`List all buckets configured for use with PCAPs API.`,builder:Or,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit pcaps ownership get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/pcaps/ownership`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.magicTransit.pcaps.ownership.get({account_id:l})),{successLabel:`Loaded`})}};function Ar(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 jr={command:`validate`,describe:`Validates buckets added to the packet captures API.`,builder:Ar,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit pcaps ownership validate`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/pcaps/ownership/validate`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({destination_conf:d(r[`destination-conf`],`destination-conf`,`text`),ownership_challenge:d(r[`ownership-challenge`],`ownership-challenge`,`text`)}):c(r.body)});return}let l=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.magicTransit.pcaps.ownership.validate({...e,account_id:p})),{successLabel:`Created`});return}r[`destination-conf`]===void 0&&(r[`destination-conf`]=await f(`destination-conf`,"The full URI for the bucket. This field only applies to `full` packet captures.")),r[`ownership-challenge`]===void 0&&(r[`ownership-challenge`]=await f(`ownership-challenge`,`The ownership challenge filename stored in the bucket.`));let m=u({destination_conf:d(r[`destination-conf`],`destination-conf`,`text`),ownership_challenge:d(r[`ownership-challenge`],`ownership-challenge`,`text`)});a(await s(`Creating`,async()=>l.magicTransit.pcaps.ownership.validate({...m,account_id:p})),{successLabel:`Created`})}},Mr={command:`ownership`,describe:`Operations for pcaps.ownership`,builder:e=>e.command(Tr).command(Dr).command(kr).command(jr).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}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Pr={command:`stop <pcap-id>`,describe:`Stop full PCAP.`,builder:Nr,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit pcaps stop`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/pcaps/${r[`pcap-id`]==null?`<pcap-id>`:encodeURIComponent(String(r[`pcap-id`]))}/stop`,pathParams:{"pcap-id":String(r[`pcap-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force,message:`This operation halts an in-progress full packet capture. Any unsaved capture data will be lost.`})){process.stderr.write(`Aborted.
102
- `);return}a(await s(`Deleting`,async()=>c.magicTransit.pcaps.stop({account_id:l,pcap_id:r[`pcap-id`]})),{successLabel:`Deleted`})}},Fr={command:`pcaps`,describe:`Operations for pcaps`,builder:e=>e.command(gr).command(xr).command(Cr).command(Pr).command(yr).command(Mr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ir(e){return e.option(`description`,{type:`string`,description:`Optional description`,default:``}).option(`name`,{type:`string`,description:`Human-readable name for the redundancy group`}).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 Lr={command:`create`,describe:`Creates a new redundancy group, optionally with tunnel members.`,builder:Ir,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit redundancy-groups create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/redundancy_groups`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({description:d(r.description,`description`,`text`),name:d(r.name,`name`,`text`)}):c(r.body)});return}let l=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.magicTransit.redundancyGroups.create({body:e,account_id:p})),{successLabel:`Created`});return}r.name===void 0&&(r.name=await f(`name`,`Human-readable name for the redundancy group`));let m=u({description:d(r.description,`description`,`text`),name:d(r.name,`name`,`text`)});a(await s(`Creating`,async()=>l.magicTransit.redundancyGroups.create({body:m,account_id:p})),{successLabel:`Created`})}};function Rr(e){return e.positional(`redundancy-group-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 zr={command:`delete <redundancy-group-id>`,describe:`Deletes a redundancy group. Member tunnels are not deleted — their redundancy_group_id is cleared.`,builder:Rr,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit redundancy-groups delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/redundancy_groups/${r[`redundancy-group-id`]==null?`<redundancy-group-id>`:encodeURIComponent(String(r[`redundancy-group-id`]))}`,pathParams:{"redundancy-group-id":String(r[`redundancy-group-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
103
- `);return}a(await s(`Deleting`,async()=>c.magicTransit.redundancyGroups.delete({account_id:l,redundancy_group_id:r[`redundancy-group-id`]})),{successLabel:`Deleted`})}};function Br(e){return e.positional(`redundancy-group-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Vr={command:`get <redundancy-group-id>`,describe:`Gets details for a specific redundancy group, including full member tunnel data.`,builder:Br,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit redundancy-groups get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/redundancy_groups/${r[`redundancy-group-id`]==null?`<redundancy-group-id>`:encodeURIComponent(String(r[`redundancy-group-id`]))}`,pathParams:{"redundancy-group-id":String(r[`redundancy-group-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.magicTransit.redundancyGroups.get({account_id:l,redundancy_group_id:r[`redundancy-group-id`]})),{successLabel:`Loaded`})}};function Hr(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ur={command:`list`,describe:`Lists redundancy groups associated with an account, including full member tunnel data.`,builder:Hr,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit redundancy-groups list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/redundancy_groups`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.magicTransit.redundancyGroups.list({account_id:l})),{successLabel:`Loaded`})}};function Wr(e){return e.positional(`redundancy-group-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`description`,{type:`string`,description:`Optional description`}).option(`name`,{type:`string`,description:`Human-readable name for the redundancy group`}).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 Gr={command:`update <redundancy-group-id>`,describe:`Replaces the name, description, and full set of members for an existing redundancy group.`,builder:Wr,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit redundancy-groups update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/redundancy_groups/${r[`redundancy-group-id`]==null?`<redundancy-group-id>`:encodeURIComponent(String(r[`redundancy-group-id`]))}`,pathParams:{"redundancy-group-id":String(r[`redundancy-group-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({description:d(r.description,`description`,`text`),name:d(r.name,`name`,`text`)}):c(r.body)});return}let l=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.magicTransit.redundancyGroups.update({body:e,account_id:p,redundancy_group_id:r[`redundancy-group-id`]})),{successLabel:`Updated`});return}r.name===void 0&&(r.name=await f(`name`,`Human-readable name for the redundancy group`));let m=u({description:d(r.description,`description`,`text`),name:d(r.name,`name`,`text`)});a(await s(`Updating`,async()=>l.magicTransit.redundancyGroups.update({body:m,account_id:p,redundancy_group_id:r[`redundancy-group-id`]})),{successLabel:`Updated`})}},Kr={command:`redundancy-groups`,describe:`Operations for redundancy-groups`,builder:e=>e.command(Lr).command(zr).command(Vr).command(Ur).command(Gr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function qr(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 Jr={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:qr,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit routes bulk-update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/routes`,pathParams:{},bodyKind:`json`,body:r.body===void 0?void 0:c(r.body)});return}let l=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.magicTransit.routes.bulkUpdate({...e,account_id:u})),{successLabel:`Updated`});return}if(r.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function Yr(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:Yr,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit routes create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/routes`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({description:d(r.description,`description`,`text`),nexthop:d(r.nexthop,`nexthop`,`text`),prefix:d(r.prefix,`prefix`,`text`),priority:r.priority,scope:{colo_names:r[`scope-colo-names`],colo_regions:r[`scope-colo-regions`]},weight:r.weight}):c(r.body)});return}let l=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.magicTransit.routes.create({...e,account_id:p})),{successLabel:`Created`});return}if(r.nexthop===void 0&&(r.nexthop=await f(`nexthop`,`The next-hop IP Address for the static route.`)),r.prefix===void 0&&(r.prefix=await f(`prefix`,`IP Prefix in Classless Inter-Domain Routing format.`)),r.priority===void 0)throw Error(`--priority is required (or pass --body with this field set).`);let m=u({description:d(r.description,`description`,`text`),nexthop:d(r.nexthop,`nexthop`,`text`),prefix:d(r.prefix,`prefix`,`text`),priority:r.priority,scope:{colo_names:r[`scope-colo-names`],colo_regions:r[`scope-colo-regions`]},weight:r.weight});a(await s(`Creating`,async()=>l.magicTransit.routes.create({...m,account_id:p})),{successLabel:`Created`})}};function Zr(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 Qr={command:`delete <route-id>`,describe:`Disable and remove a specific Magic static route.`,builder:Zr,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit routes delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/routes/${r[`route-id`]==null?`<route-id>`:encodeURIComponent(String(r[`route-id`]))}`,pathParams:{"route-id":String(r[`route-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
104
- `);return}a(await s(`Deleting`,async()=>c.magicTransit.routes.delete({account_id:l,route_id:r[`route-id`]})),{successLabel:`Deleted`})}};function $r(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 ei={command:`empty`,describe:`Delete multiple Magic static routes.`,builder:$r,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit routes empty`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/routes`,pathParams:{},bodyKind:`json`,body:r.body===void 0?void 0:c(r.body)});return}let l=await i(r),u=r.local?e:await t();if(r.accountId=u,!await m({force:!!r.force})){process.stderr.write(`Aborted.
105
- `);return}if(r.body){let e=c(r.body);a(await s(`Deleting`,async()=>l.magicTransit.routes.empty({...e,account_id:u})),{successLabel:`Deleted`});return}if(r.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function ti(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 ni={command:`get <route-id>`,describe:`Get a specific Magic static route.`,builder:ti,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit routes get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/routes/${r[`route-id`]==null?`<route-id>`:encodeURIComponent(String(r[`route-id`]))}`,pathParams:{"route-id":String(r[`route-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.magicTransit.routes.get({account_id:l,route_id:r[`route-id`]})),{successLabel:`Loaded`})}};function ri(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ii={command:`list`,describe:`List all Magic static routes.`,builder:ri,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit routes list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/routes`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.magicTransit.routes.list({account_id:l})),{successLabel:`Loaded`})}};function ai(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 oi={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:ai,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit routes update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/routes/${r[`route-id`]==null?`<route-id>`:encodeURIComponent(String(r[`route-id`]))}`,pathParams:{"route-id":String(r[`route-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({description:d(r.description,`description`,`text`),nexthop:d(r.nexthop,`nexthop`,`text`),prefix:d(r.prefix,`prefix`,`text`),priority:r.priority,scope:{colo_names:r[`scope-colo-names`],colo_regions:r[`scope-colo-regions`]},weight:r.weight}):c(r.body)});return}let l=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.magicTransit.routes.update({body:e,account_id:p,route_id:r[`route-id`]})),{successLabel:`Updated`});return}if(r.nexthop===void 0&&(r.nexthop=await f(`nexthop`,`The next-hop IP Address for the static route.`)),r.prefix===void 0&&(r.prefix=await f(`prefix`,`IP Prefix in Classless Inter-Domain Routing format.`)),r.priority===void 0)throw Error(`--priority is required (or pass --body with this field set).`);let m=u({description:d(r.description,`description`,`text`),nexthop:d(r.nexthop,`nexthop`,`text`),prefix:d(r.prefix,`prefix`,`text`),priority:r.priority,scope:{colo_names:r[`scope-colo-names`],colo_regions:r[`scope-colo-regions`]},weight:r.weight});a(await s(`Updating`,async()=>l.magicTransit.routes.update({body:m,account_id:p,route_id:r[`route-id`]})),{successLabel:`Updated`})}},si={command:`routes`,describe:`Static routes that direct IP prefix traffic through specific GRE/IPsec tunnels`,builder:e=>e.command(Jr).command(Xr).command(Qr).command(ei).command(ni).command(ii).command(oi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ci(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 li={command:`create <site-id>`,describe:`Creates a new Site ACL.`,builder:ci,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites acls create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${r[`site-id`]==null?`<site-id>`:encodeURIComponent(String(r[`site-id`]))}/acls`,pathParams:{"site-id":String(r[`site-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({description:d(r.description,`description`,`text`),forward_locally:r[`forward-locally`],lan_1:{lan_id:d(r[`lan-1-lan-id`],`lan-1-lan-id`,`text`),lan_name:d(r[`lan-1-lan-name`],`lan-1-lan-name`,`text`),port_ranges:r[`lan-1-port-ranges`],ports:r[`lan-1-ports`]},lan_2:{lan_id:d(r[`lan-2-lan-id`],`lan-2-lan-id`,`text`),lan_name:d(r[`lan-2-lan-name`],`lan-2-lan-name`,`text`),port_ranges:r[`lan-2-port-ranges`],ports:r[`lan-2-ports`]},name:d(r.name,`name`,`text`),protocols:r.protocols,unidirectional:r.unidirectional}):c(r.body)});return}let l=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.magicTransit.sites.acls.create({...e,account_id:p,site_id:r[`site-id`]})),{successLabel:`Created`});return}r[`lan-1-lan-id`]===void 0&&(r[`lan-1-lan-id`]=await f(`lan-1-lan-id`,`The identifier for the LAN you want to create an ACL policy with.`)),r[`lan-2-lan-id`]===void 0&&(r[`lan-2-lan-id`]=await f(`lan-2-lan-id`,`The identifier for the LAN you want to create an ACL policy with.`)),r.name===void 0&&(r.name=await f(`name`,`The name of the ACL.`));let m=u({description:d(r.description,`description`,`text`),forward_locally:r[`forward-locally`],lan_1:{lan_id:d(r[`lan-1-lan-id`],`lan-1-lan-id`,`text`),lan_name:d(r[`lan-1-lan-name`],`lan-1-lan-name`,`text`),port_ranges:r[`lan-1-port-ranges`],ports:r[`lan-1-ports`]},lan_2:{lan_id:d(r[`lan-2-lan-id`],`lan-2-lan-id`,`text`),lan_name:d(r[`lan-2-lan-name`],`lan-2-lan-name`,`text`),port_ranges:r[`lan-2-port-ranges`],ports:r[`lan-2-ports`]},name:d(r.name,`name`,`text`),protocols:r.protocols,unidirectional:r.unidirectional});a(await s(`Creating`,async()=>l.magicTransit.sites.acls.create({...m,account_id:p,site_id:r[`site-id`]})),{successLabel:`Created`})}};function ui(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 di={command:`delete <acl-id>`,describe:`Remove a specific Site ACL.`,builder:ui,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites acls delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${r[`site-id`]==null?`<site-id>`:encodeURIComponent(String(r[`site-id`]))}/acls/${r[`acl-id`]==null?`<acl-id>`:encodeURIComponent(String(r[`acl-id`]))}`,pathParams:{"site-id":String(r[`site-id`]??``),"acl-id":String(r[`acl-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
106
- `);return}a(await s(`Deleting`,async()=>c.magicTransit.sites.acls.delete({account_id:l,site_id:r[`site-id`],acl_id:r[`acl-id`]})),{successLabel:`Deleted`})}};function fi(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 pi={command:`edit <acl-id>`,describe:`Patch a specific Site ACL.`,builder:fi,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites acls edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${r[`site-id`]==null?`<site-id>`:encodeURIComponent(String(r[`site-id`]))}/acls/${r[`acl-id`]==null?`<acl-id>`:encodeURIComponent(String(r[`acl-id`]))}`,pathParams:{"site-id":String(r[`site-id`]??``),"acl-id":String(r[`acl-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({description:d(r.description,`description`,`text`),forward_locally:r[`forward-locally`],lan_1:{lan_id:d(r[`lan-1-lan-id`],`lan-1-lan-id`,`text`),lan_name:d(r[`lan-1-lan-name`],`lan-1-lan-name`,`text`),port_ranges:r[`lan-1-port-ranges`],ports:r[`lan-1-ports`]},lan_2:{lan_id:d(r[`lan-2-lan-id`],`lan-2-lan-id`,`text`),lan_name:d(r[`lan-2-lan-name`],`lan-2-lan-name`,`text`),port_ranges:r[`lan-2-port-ranges`],ports:r[`lan-2-ports`]},name:d(r.name,`name`,`text`),protocols:r.protocols,unidirectional:r.unidirectional}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.magicTransit.sites.acls.edit({body:e,account_id:f,site_id:r[`site-id`],acl_id:r[`acl-id`]})),{successLabel:`Updated`});return}let p=u({description:d(r.description,`description`,`text`),forward_locally:r[`forward-locally`],lan_1:{lan_id:d(r[`lan-1-lan-id`],`lan-1-lan-id`,`text`),lan_name:d(r[`lan-1-lan-name`],`lan-1-lan-name`,`text`),port_ranges:r[`lan-1-port-ranges`],ports:r[`lan-1-ports`]},lan_2:{lan_id:d(r[`lan-2-lan-id`],`lan-2-lan-id`,`text`),lan_name:d(r[`lan-2-lan-name`],`lan-2-lan-name`,`text`),port_ranges:r[`lan-2-port-ranges`],ports:r[`lan-2-ports`]},name:d(r.name,`name`,`text`),protocols:r.protocols,unidirectional:r.unidirectional});a(await s(`Updating`,async()=>l.magicTransit.sites.acls.edit({body:p,account_id:f,site_id:r[`site-id`],acl_id:r[`acl-id`]})),{successLabel:`Updated`})}};function mi(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 hi={command:`get <acl-id>`,describe:`Get a specific Site ACL.`,builder:mi,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites acls get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${r[`site-id`]==null?`<site-id>`:encodeURIComponent(String(r[`site-id`]))}/acls/${r[`acl-id`]==null?`<acl-id>`:encodeURIComponent(String(r[`acl-id`]))}`,pathParams:{"site-id":String(r[`site-id`]??``),"acl-id":String(r[`acl-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.magicTransit.sites.acls.get({account_id:l,site_id:r[`site-id`],acl_id:r[`acl-id`]})),{successLabel:`Loaded`})}};function gi(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 _i={command:`list`,describe:`Lists Site ACLs associated with an account.`,builder:gi,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites acls list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${r[`site-id`]==null?`<site-id>`:encodeURIComponent(String(r[`site-id`]))}/acls`,pathParams:{"site-id":String(r[`site-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.magicTransit.sites.acls.list({account_id:l,site_id:r[`site-id`]})),{successLabel:`Loaded`})}};function vi(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 yi={command:`update <acl-id>`,describe:`Update a specific Site ACL.`,builder:vi,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites acls update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${r[`site-id`]==null?`<site-id>`:encodeURIComponent(String(r[`site-id`]))}/acls/${r[`acl-id`]==null?`<acl-id>`:encodeURIComponent(String(r[`acl-id`]))}`,pathParams:{"site-id":String(r[`site-id`]??``),"acl-id":String(r[`acl-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({description:d(r.description,`description`,`text`),forward_locally:r[`forward-locally`],lan_1:{lan_id:d(r[`lan-1-lan-id`],`lan-1-lan-id`,`text`),lan_name:d(r[`lan-1-lan-name`],`lan-1-lan-name`,`text`),port_ranges:r[`lan-1-port-ranges`],ports:r[`lan-1-ports`]},lan_2:{lan_id:d(r[`lan-2-lan-id`],`lan-2-lan-id`,`text`),lan_name:d(r[`lan-2-lan-name`],`lan-2-lan-name`,`text`),port_ranges:r[`lan-2-port-ranges`],ports:r[`lan-2-ports`]},name:d(r.name,`name`,`text`),protocols:r.protocols,unidirectional:r.unidirectional}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.magicTransit.sites.acls.update({body:e,account_id:f,site_id:r[`site-id`],acl_id:r[`acl-id`]})),{successLabel:`Updated`});return}let p=u({description:d(r.description,`description`,`text`),forward_locally:r[`forward-locally`],lan_1:{lan_id:d(r[`lan-1-lan-id`],`lan-1-lan-id`,`text`),lan_name:d(r[`lan-1-lan-name`],`lan-1-lan-name`,`text`),port_ranges:r[`lan-1-port-ranges`],ports:r[`lan-1-ports`]},lan_2:{lan_id:d(r[`lan-2-lan-id`],`lan-2-lan-id`,`text`),lan_name:d(r[`lan-2-lan-name`],`lan-2-lan-name`,`text`),port_ranges:r[`lan-2-port-ranges`],ports:r[`lan-2-ports`]},name:d(r.name,`name`,`text`),protocols:r.protocols,unidirectional:r.unidirectional});a(await s(`Updating`,async()=>l.magicTransit.sites.acls.update({body:p,account_id:f,site_id:r[`site-id`],acl_id:r[`acl-id`]})),{successLabel:`Updated`})}},bi={command:`acls`,describe:`Operations for sites.acls`,builder:e=>e.command(li).command(di).command(pi).command(hi).command(_i).command(yi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function xi(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 Si={command:`create <site-id>`,describe:`Creates a new App Config for a site`,builder:xi,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites app-configuration create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${r[`site-id`]==null?`<site-id>`:encodeURIComponent(String(r[`site-id`]))}/app_configs`,pathParams:{"site-id":String(r[`site-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({breakout:r.breakout,preferred_wans:r[`preferred-wans`],priority:r.priority}):c(r.body)});return}let l=await i(r),d=r.local?e:await t();if(r.accountId=d,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.magicTransit.sites.appConfiguration.create({...e,account_id:d,site_id:r[`site-id`]})),{successLabel:`Created`});return}let f=u({breakout:r.breakout,preferred_wans:r[`preferred-wans`],priority:r.priority});a(await s(`Creating`,async()=>l.magicTransit.sites.appConfiguration.create({...f,account_id:d,site_id:r[`site-id`]})),{successLabel:`Created`})}};function Ci(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 wi={command:`delete <app-config-id>`,describe:`Deletes specific App Config associated with a site.`,builder:Ci,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites app-configuration delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${r[`site-id`]==null?`<site-id>`:encodeURIComponent(String(r[`site-id`]))}/app_configs/${r[`app-config-id`]==null?`<app-config-id>`:encodeURIComponent(String(r[`app-config-id`]))}`,pathParams:{"site-id":String(r[`site-id`]??``),"app-config-id":String(r[`app-config-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
107
- `);return}a(await s(`Deleting`,async()=>c.magicTransit.sites.appConfiguration.delete({account_id:l,site_id:r[`site-id`],app_config_id:r[`app-config-id`]})),{successLabel:`Deleted`})}};function Ti(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 Ei={command:`edit <app-config-id>`,describe:`Updates an App Config for a site`,builder:Ti,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites app-configuration edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${r[`site-id`]==null?`<site-id>`:encodeURIComponent(String(r[`site-id`]))}/app_configs/${r[`app-config-id`]==null?`<app-config-id>`:encodeURIComponent(String(r[`app-config-id`]))}`,pathParams:{"site-id":String(r[`site-id`]??``),"app-config-id":String(r[`app-config-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({account_app_id:d(r[`account-app-id`],`account-app-id`,`text`),breakout:r.breakout,managed_app_id:d(r[`managed-app-id`],`managed-app-id`,`text`),preferred_wans:r[`preferred-wans`],priority:r.priority}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.magicTransit.sites.appConfiguration.edit({body:e,account_id:f,site_id:r[`site-id`],app_config_id:r[`app-config-id`]})),{successLabel:`Updated`});return}let p=u({account_app_id:d(r[`account-app-id`],`account-app-id`,`text`),breakout:r.breakout,managed_app_id:d(r[`managed-app-id`],`managed-app-id`,`text`),preferred_wans:r[`preferred-wans`],priority:r.priority});a(await s(`Updating`,async()=>l.magicTransit.sites.appConfiguration.edit({body:p,account_id:f,site_id:r[`site-id`],app_config_id:r[`app-config-id`]})),{successLabel:`Updated`})}};function Di(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 Oi={command:`list`,describe:`Lists App Configs associated with a site.`,builder:Di,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites app-configuration list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${r[`site-id`]==null?`<site-id>`:encodeURIComponent(String(r[`site-id`]))}/app_configs`,pathParams:{"site-id":String(r[`site-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.magicTransit.sites.appConfiguration.list({account_id:l,site_id:r[`site-id`]})),{successLabel:`Loaded`})}};function ki(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 Ai={command:`update <app-config-id>`,describe:`Updates an App Config for a site`,builder:ki,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites app-configuration update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${r[`site-id`]==null?`<site-id>`:encodeURIComponent(String(r[`site-id`]))}/app_configs/${r[`app-config-id`]==null?`<app-config-id>`:encodeURIComponent(String(r[`app-config-id`]))}`,pathParams:{"site-id":String(r[`site-id`]??``),"app-config-id":String(r[`app-config-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({account_app_id:d(r[`account-app-id`],`account-app-id`,`text`),breakout:r.breakout,managed_app_id:d(r[`managed-app-id`],`managed-app-id`,`text`),preferred_wans:r[`preferred-wans`],priority:r.priority}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.magicTransit.sites.appConfiguration.update({body:e,account_id:f,site_id:r[`site-id`],app_config_id:r[`app-config-id`]})),{successLabel:`Updated`});return}let p=u({account_app_id:d(r[`account-app-id`],`account-app-id`,`text`),breakout:r.breakout,managed_app_id:d(r[`managed-app-id`],`managed-app-id`,`text`),preferred_wans:r[`preferred-wans`],priority:r.priority});a(await s(`Updating`,async()=>l.magicTransit.sites.appConfiguration.update({body:p,account_id:f,site_id:r[`site-id`],app_config_id:r[`app-config-id`]})),{successLabel:`Updated`})}},ji={command:`app-configuration`,describe:`Operations for sites.app-configuration`,builder:e=>e.command(Si).command(wi).command(Ei).command(Oi).command(Ai).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Mi(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 Ni={command:`create`,describe:`Creates a new Site`,builder:Mi,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({connector_id:d(r[`connector-id`],`connector-id`,`text`),description:d(r.description,`description`,`text`),ha_mode:r[`ha-mode`],location:{lat:d(r[`location-lat`],`location-lat`,`text`),lon:d(r[`location-lon`],`location-lon`,`text`)},name:d(r.name,`name`,`text`),secondary_connector_id:d(r[`secondary-connector-id`],`secondary-connector-id`,`text`)}):c(r.body)});return}let l=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.magicTransit.sites.create({...e,account_id:p})),{successLabel:`Created`});return}r.name===void 0&&(r.name=await f(`name`,`The name of the site.`));let m=u({connector_id:d(r[`connector-id`],`connector-id`,`text`),description:d(r.description,`description`,`text`),ha_mode:r[`ha-mode`],location:{lat:d(r[`location-lat`],`location-lat`,`text`),lon:d(r[`location-lon`],`location-lon`,`text`)},name:d(r.name,`name`,`text`),secondary_connector_id:d(r[`secondary-connector-id`],`secondary-connector-id`,`text`)});a(await s(`Creating`,async()=>l.magicTransit.sites.create({...m,account_id:p})),{successLabel:`Created`})}};function Pi(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 Fi={command:`delete <site-id>`,describe:`Remove a specific Site.`,builder:Pi,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${r[`site-id`]==null?`<site-id>`:encodeURIComponent(String(r[`site-id`]))}`,pathParams:{"site-id":String(r[`site-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
108
- `);return}a(await s(`Deleting`,async()=>c.magicTransit.sites.delete({account_id:l,site_id:r[`site-id`]})),{successLabel:`Deleted`})}};function Ii(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 Li={command:`edit <site-id>`,describe:`Patch a specific Site.`,builder:Ii,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${r[`site-id`]==null?`<site-id>`:encodeURIComponent(String(r[`site-id`]))}`,pathParams:{"site-id":String(r[`site-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({connector_id:d(r[`connector-id`],`connector-id`,`text`),description:d(r.description,`description`,`text`),location:{lat:d(r[`location-lat`],`location-lat`,`text`),lon:d(r[`location-lon`],`location-lon`,`text`)},name:d(r.name,`name`,`text`),secondary_connector_id:d(r[`secondary-connector-id`],`secondary-connector-id`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.magicTransit.sites.edit({body:e,account_id:f,site_id:r[`site-id`]})),{successLabel:`Updated`});return}let p=u({connector_id:d(r[`connector-id`],`connector-id`,`text`),description:d(r.description,`description`,`text`),location:{lat:d(r[`location-lat`],`location-lat`,`text`),lon:d(r[`location-lon`],`location-lon`,`text`)},name:d(r.name,`name`,`text`),secondary_connector_id:d(r[`secondary-connector-id`],`secondary-connector-id`,`text`)});a(await s(`Updating`,async()=>l.magicTransit.sites.edit({body:p,account_id:f,site_id:r[`site-id`]})),{successLabel:`Updated`})}};function Ri(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 zi={command:`get <site-id>`,describe:`Get a specific Site.`,builder:Ri,handler:async c=>{let l={};if(c[`x-magic-new-hc-target`]!==void 0&&(l[`x-magic-new-hc-target`]=String(c[`x-magic-new-hc-target`])),c.dryRun){o({command:`cf magic-transit sites get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${c[`site-id`]==null?`<site-id>`:encodeURIComponent(String(c[`site-id`]))}`,pathParams:{"site-id":String(c[`site-id`]??``)},bodyKind:`none`});return}let u=await i(c),d=c.local?e:await t();c.accountId=d,a(await s(`Loading`,async()=>r(u,`GET`,`/accounts/${d}/magic/sites/${encodeURIComponent(String(c[`site-id`]))}`,{headers:Object.keys(l).length>0?l:void 0})),{successLabel:`Loaded`})}};function Bi(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 Vi={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:Bi,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites lans create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${r[`site-id`]==null?`<site-id>`:encodeURIComponent(String(r[`site-id`]))}/lans`,pathParams:{"site-id":String(r[`site-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({bond_id:r[`bond-id`],ha_link:r[`ha-link`],is_breakout:r[`is-breakout`],is_prioritized:r[`is-prioritized`],name:d(r.name,`name`,`text`),nat:{static_prefix:d(r[`nat-static-prefix`],`nat-static-prefix`,`text`)},physport:r.physport,static_addressing:{address:d(r[`static-addressing-address`],`static-addressing-address`,`text`),dhcp_relay:{server_addresses:r[`static-addressing-dhcp-relay-server-addresses`]},dhcp_server:{dhcp_pool_end:d(r[`static-addressing-dhcp-server-dhcp-pool-end`],`static-addressing-dhcp-server-dhcp-pool-end`,`text`),dhcp_pool_start:d(r[`static-addressing-dhcp-server-dhcp-pool-start`],`static-addressing-dhcp-server-dhcp-pool-start`,`text`),dns_server:d(r[`static-addressing-dhcp-server-dns-server`],`static-addressing-dhcp-server-dns-server`,`text`),dns_servers:r[`static-addressing-dhcp-server-dns-servers`]},secondary_address:d(r[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`),virtual_address:d(r[`static-addressing-virtual-address`],`static-addressing-virtual-address`,`text`)},vlan_tag:r[`vlan-tag`]}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.magicTransit.sites.lans.create({...e,account_id:f,site_id:r[`site-id`]})),{successLabel:`Created`});return}let p=u({bond_id:r[`bond-id`],ha_link:r[`ha-link`],is_breakout:r[`is-breakout`],is_prioritized:r[`is-prioritized`],name:d(r.name,`name`,`text`),nat:{static_prefix:d(r[`nat-static-prefix`],`nat-static-prefix`,`text`)},physport:r.physport,static_addressing:{address:d(r[`static-addressing-address`],`static-addressing-address`,`text`),dhcp_relay:{server_addresses:r[`static-addressing-dhcp-relay-server-addresses`]},dhcp_server:{dhcp_pool_end:d(r[`static-addressing-dhcp-server-dhcp-pool-end`],`static-addressing-dhcp-server-dhcp-pool-end`,`text`),dhcp_pool_start:d(r[`static-addressing-dhcp-server-dhcp-pool-start`],`static-addressing-dhcp-server-dhcp-pool-start`,`text`),dns_server:d(r[`static-addressing-dhcp-server-dns-server`],`static-addressing-dhcp-server-dns-server`,`text`),dns_servers:r[`static-addressing-dhcp-server-dns-servers`]},secondary_address:d(r[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`),virtual_address:d(r[`static-addressing-virtual-address`],`static-addressing-virtual-address`,`text`)},vlan_tag:r[`vlan-tag`]});a(await s(`Creating`,async()=>l.magicTransit.sites.lans.create({...p,account_id:f,site_id:r[`site-id`]})),{successLabel:`Created`})}};function Hi(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 Ui={command:`delete <lan-id>`,describe:`Remove a specific Site LAN.`,builder:Hi,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites lans delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${r[`site-id`]==null?`<site-id>`:encodeURIComponent(String(r[`site-id`]))}/lans/${r[`lan-id`]==null?`<lan-id>`:encodeURIComponent(String(r[`lan-id`]))}`,pathParams:{"site-id":String(r[`site-id`]??``),"lan-id":String(r[`lan-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
109
- `);return}a(await s(`Deleting`,async()=>c.magicTransit.sites.lans.delete({account_id:l,site_id:r[`site-id`],lan_id:r[`lan-id`]})),{successLabel:`Deleted`})}};function Wi(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:Wi,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites lans edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${r[`site-id`]==null?`<site-id>`:encodeURIComponent(String(r[`site-id`]))}/lans/${r[`lan-id`]==null?`<lan-id>`:encodeURIComponent(String(r[`lan-id`]))}`,pathParams:{"site-id":String(r[`site-id`]??``),"lan-id":String(r[`lan-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({bond_id:r[`bond-id`],is_breakout:r[`is-breakout`],is_prioritized:r[`is-prioritized`],name:d(r.name,`name`,`text`),nat:{static_prefix:d(r[`nat-static-prefix`],`nat-static-prefix`,`text`)},physport:r.physport,static_addressing:{address:d(r[`static-addressing-address`],`static-addressing-address`,`text`),dhcp_relay:{server_addresses:r[`static-addressing-dhcp-relay-server-addresses`]},dhcp_server:{dhcp_pool_end:d(r[`static-addressing-dhcp-server-dhcp-pool-end`],`static-addressing-dhcp-server-dhcp-pool-end`,`text`),dhcp_pool_start:d(r[`static-addressing-dhcp-server-dhcp-pool-start`],`static-addressing-dhcp-server-dhcp-pool-start`,`text`),dns_server:d(r[`static-addressing-dhcp-server-dns-server`],`static-addressing-dhcp-server-dns-server`,`text`),dns_servers:r[`static-addressing-dhcp-server-dns-servers`]},secondary_address:d(r[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`),virtual_address:d(r[`static-addressing-virtual-address`],`static-addressing-virtual-address`,`text`)},vlan_tag:r[`vlan-tag`]}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.magicTransit.sites.lans.edit({body:e,account_id:f,site_id:r[`site-id`],lan_id:r[`lan-id`]})),{successLabel:`Updated`});return}let p=u({bond_id:r[`bond-id`],is_breakout:r[`is-breakout`],is_prioritized:r[`is-prioritized`],name:d(r.name,`name`,`text`),nat:{static_prefix:d(r[`nat-static-prefix`],`nat-static-prefix`,`text`)},physport:r.physport,static_addressing:{address:d(r[`static-addressing-address`],`static-addressing-address`,`text`),dhcp_relay:{server_addresses:r[`static-addressing-dhcp-relay-server-addresses`]},dhcp_server:{dhcp_pool_end:d(r[`static-addressing-dhcp-server-dhcp-pool-end`],`static-addressing-dhcp-server-dhcp-pool-end`,`text`),dhcp_pool_start:d(r[`static-addressing-dhcp-server-dhcp-pool-start`],`static-addressing-dhcp-server-dhcp-pool-start`,`text`),dns_server:d(r[`static-addressing-dhcp-server-dns-server`],`static-addressing-dhcp-server-dns-server`,`text`),dns_servers:r[`static-addressing-dhcp-server-dns-servers`]},secondary_address:d(r[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`),virtual_address:d(r[`static-addressing-virtual-address`],`static-addressing-virtual-address`,`text`)},vlan_tag:r[`vlan-tag`]});a(await s(`Updating`,async()=>l.magicTransit.sites.lans.edit({body:p,account_id:f,site_id:r[`site-id`],lan_id:r[`lan-id`]})),{successLabel:`Updated`})}};function Ki(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 qi={command:`get <lan-id>`,describe:`Get a specific Site LAN.`,builder:Ki,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites lans get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${r[`site-id`]==null?`<site-id>`:encodeURIComponent(String(r[`site-id`]))}/lans/${r[`lan-id`]==null?`<lan-id>`:encodeURIComponent(String(r[`lan-id`]))}`,pathParams:{"site-id":String(r[`site-id`]??``),"lan-id":String(r[`lan-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.magicTransit.sites.lans.get({account_id:l,site_id:r[`site-id`],lan_id:r[`lan-id`]})),{successLabel:`Loaded`})}};function Ji(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 Yi={command:`list`,describe:`Lists Site LANs associated with an account.`,builder:Ji,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites lans list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${r[`site-id`]==null?`<site-id>`:encodeURIComponent(String(r[`site-id`]))}/lans`,pathParams:{"site-id":String(r[`site-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.magicTransit.sites.lans.list({account_id:l,site_id:r[`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 Zi={command:`update <lan-id>`,describe:`Update a specific Site LAN.`,builder:Xi,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites lans update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${r[`site-id`]==null?`<site-id>`:encodeURIComponent(String(r[`site-id`]))}/lans/${r[`lan-id`]==null?`<lan-id>`:encodeURIComponent(String(r[`lan-id`]))}`,pathParams:{"site-id":String(r[`site-id`]??``),"lan-id":String(r[`lan-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({bond_id:r[`bond-id`],is_breakout:r[`is-breakout`],is_prioritized:r[`is-prioritized`],name:d(r.name,`name`,`text`),nat:{static_prefix:d(r[`nat-static-prefix`],`nat-static-prefix`,`text`)},physport:r.physport,static_addressing:{address:d(r[`static-addressing-address`],`static-addressing-address`,`text`),dhcp_relay:{server_addresses:r[`static-addressing-dhcp-relay-server-addresses`]},dhcp_server:{dhcp_pool_end:d(r[`static-addressing-dhcp-server-dhcp-pool-end`],`static-addressing-dhcp-server-dhcp-pool-end`,`text`),dhcp_pool_start:d(r[`static-addressing-dhcp-server-dhcp-pool-start`],`static-addressing-dhcp-server-dhcp-pool-start`,`text`),dns_server:d(r[`static-addressing-dhcp-server-dns-server`],`static-addressing-dhcp-server-dns-server`,`text`),dns_servers:r[`static-addressing-dhcp-server-dns-servers`]},secondary_address:d(r[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`),virtual_address:d(r[`static-addressing-virtual-address`],`static-addressing-virtual-address`,`text`)},vlan_tag:r[`vlan-tag`]}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.magicTransit.sites.lans.update({body:e,account_id:f,site_id:r[`site-id`],lan_id:r[`lan-id`]})),{successLabel:`Updated`});return}let p=u({bond_id:r[`bond-id`],is_breakout:r[`is-breakout`],is_prioritized:r[`is-prioritized`],name:d(r.name,`name`,`text`),nat:{static_prefix:d(r[`nat-static-prefix`],`nat-static-prefix`,`text`)},physport:r.physport,static_addressing:{address:d(r[`static-addressing-address`],`static-addressing-address`,`text`),dhcp_relay:{server_addresses:r[`static-addressing-dhcp-relay-server-addresses`]},dhcp_server:{dhcp_pool_end:d(r[`static-addressing-dhcp-server-dhcp-pool-end`],`static-addressing-dhcp-server-dhcp-pool-end`,`text`),dhcp_pool_start:d(r[`static-addressing-dhcp-server-dhcp-pool-start`],`static-addressing-dhcp-server-dhcp-pool-start`,`text`),dns_server:d(r[`static-addressing-dhcp-server-dns-server`],`static-addressing-dhcp-server-dns-server`,`text`),dns_servers:r[`static-addressing-dhcp-server-dns-servers`]},secondary_address:d(r[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`),virtual_address:d(r[`static-addressing-virtual-address`],`static-addressing-virtual-address`,`text`)},vlan_tag:r[`vlan-tag`]});a(await s(`Updating`,async()=>l.magicTransit.sites.lans.update({body:p,account_id:f,site_id:r[`site-id`],lan_id:r[`lan-id`]})),{successLabel:`Updated`})}},Qi={command:`lans`,describe:`Operations for sites.lans`,builder:e=>e.command(Vi).command(Ui).command(Gi).command(qi).command(Yi).command(Zi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function $i(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 ea={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:$i,handler:async r=>{let c={connectorid:r.connectorid};if(r.dryRun){o({command:`cf magic-transit sites list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.magicTransit.sites.list({account_id:u,...c})),{successLabel:`Loaded`})}};function ta(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 na={command:`create <site-id>`,describe:`Creates a NetFlow configuration for a site.`,builder:ta,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites netflow-config create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${r[`site-id`]==null?`<site-id>`:encodeURIComponent(String(r[`site-id`]))}/netflow_config`,pathParams:{"site-id":String(r[`site-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({active_timeout:r[`active-timeout`],collector_ip:d(r[`collector-ip`],`collector-ip`,`text`),collector_port:r[`collector-port`],inactive_timeout:r[`inactive-timeout`],sampling_rate:r[`sampling-rate`]}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.magicTransit.sites.netflowConfig.create({body:e,account_id:f,site_id:r[`site-id`]})),{successLabel:`Created`});return}let p=u({active_timeout:r[`active-timeout`],collector_ip:d(r[`collector-ip`],`collector-ip`,`text`),collector_port:r[`collector-port`],inactive_timeout:r[`inactive-timeout`],sampling_rate:r[`sampling-rate`]});a(await s(`Creating`,async()=>l.magicTransit.sites.netflowConfig.create({body:p,account_id:f,site_id:r[`site-id`]})),{successLabel:`Created`})}};function ra(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 ia={command:`delete <site-id>`,describe:`Remove NetFlow configuration for a site.`,builder:ra,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites netflow-config delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${r[`site-id`]==null?`<site-id>`:encodeURIComponent(String(r[`site-id`]))}/netflow_config`,pathParams:{"site-id":String(r[`site-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
110
- `);return}a(await s(`Deleting`,async()=>c.magicTransit.sites.netflowConfig.delete({account_id:l,site_id:r[`site-id`]})),{successLabel:`Deleted`})}};function aa(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 oa={command:`edit <site-id>`,describe:`Updates NetFlow configuration for a site.`,builder:aa,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites netflow-config edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${r[`site-id`]==null?`<site-id>`:encodeURIComponent(String(r[`site-id`]))}/netflow_config`,pathParams:{"site-id":String(r[`site-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({active_timeout:r[`active-timeout`],collector_ip:d(r[`collector-ip`],`collector-ip`,`text`),collector_port:r[`collector-port`],inactive_timeout:r[`inactive-timeout`],sampling_rate:r[`sampling-rate`]}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.magicTransit.sites.netflowConfig.edit({body:e,account_id:f,site_id:r[`site-id`]})),{successLabel:`Updated`});return}let p=u({active_timeout:r[`active-timeout`],collector_ip:d(r[`collector-ip`],`collector-ip`,`text`),collector_port:r[`collector-port`],inactive_timeout:r[`inactive-timeout`],sampling_rate:r[`sampling-rate`]});a(await s(`Updating`,async()=>l.magicTransit.sites.netflowConfig.edit({body:p,account_id:f,site_id:r[`site-id`]})),{successLabel:`Updated`})}};function sa(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 ca={command:`get <site-id>`,describe:`Get NetFlow configuration for a site.`,builder:sa,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites netflow-config get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${r[`site-id`]==null?`<site-id>`:encodeURIComponent(String(r[`site-id`]))}/netflow_config`,pathParams:{"site-id":String(r[`site-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.magicTransit.sites.netflowConfig.get({account_id:l,site_id:r[`site-id`]})),{successLabel:`Loaded`})}};function la(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 ua={command:`update <site-id>`,describe:`Updates NetFlow configuration for a site (partial update).`,builder:la,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites netflow-config update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${r[`site-id`]==null?`<site-id>`:encodeURIComponent(String(r[`site-id`]))}/netflow_config`,pathParams:{"site-id":String(r[`site-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({active_timeout:r[`active-timeout`],collector_ip:d(r[`collector-ip`],`collector-ip`,`text`),collector_port:r[`collector-port`],inactive_timeout:r[`inactive-timeout`],sampling_rate:r[`sampling-rate`]}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.magicTransit.sites.netflowConfig.update({body:e,account_id:f,site_id:r[`site-id`]})),{successLabel:`Updated`});return}let p=u({active_timeout:r[`active-timeout`],collector_ip:d(r[`collector-ip`],`collector-ip`,`text`),collector_port:r[`collector-port`],inactive_timeout:r[`inactive-timeout`],sampling_rate:r[`sampling-rate`]});a(await s(`Updating`,async()=>l.magicTransit.sites.netflowConfig.update({body:p,account_id:f,site_id:r[`site-id`]})),{successLabel:`Updated`})}},da={command:`netflow-config`,describe:`Operations for sites.netflow-config`,builder:e=>e.command(na).command(ia).command(oa).command(ca).command(ua).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function fa(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 pa={command:`update <site-id>`,describe:`Update a specific Site.`,builder:fa,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${r[`site-id`]==null?`<site-id>`:encodeURIComponent(String(r[`site-id`]))}`,pathParams:{"site-id":String(r[`site-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({connector_id:d(r[`connector-id`],`connector-id`,`text`),description:d(r.description,`description`,`text`),location:{lat:d(r[`location-lat`],`location-lat`,`text`),lon:d(r[`location-lon`],`location-lon`,`text`)},name:d(r.name,`name`,`text`),secondary_connector_id:d(r[`secondary-connector-id`],`secondary-connector-id`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.magicTransit.sites.update({body:e,account_id:f,site_id:r[`site-id`]})),{successLabel:`Updated`});return}let p=u({connector_id:d(r[`connector-id`],`connector-id`,`text`),description:d(r.description,`description`,`text`),location:{lat:d(r[`location-lat`],`location-lat`,`text`),lon:d(r[`location-lon`],`location-lon`,`text`)},name:d(r.name,`name`,`text`),secondary_connector_id:d(r[`secondary-connector-id`],`secondary-connector-id`,`text`)});a(await s(`Updating`,async()=>l.magicTransit.sites.update({body:p,account_id:f,site_id:r[`site-id`]})),{successLabel:`Updated`})}};function ma(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 ha={command:`create <site-id>`,describe:`Creates a new Site WAN.`,builder:ma,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites wans create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${r[`site-id`]==null?`<site-id>`:encodeURIComponent(String(r[`site-id`]))}/wans`,pathParams:{"site-id":String(r[`site-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({name:d(r.name,`name`,`text`),physport:r.physport,priority:r.priority,static_addressing:{address:d(r[`static-addressing-address`],`static-addressing-address`,`text`),gateway_address:d(r[`static-addressing-gateway-address`],`static-addressing-gateway-address`,`text`),secondary_address:d(r[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`)},vlan_tag:r[`vlan-tag`]}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.magicTransit.sites.wans.create({...e,account_id:f,site_id:r[`site-id`]})),{successLabel:`Created`});return}if(r.physport===void 0)throw Error(`--physport is required (or pass --body with this field set).`);let p=u({name:d(r.name,`name`,`text`),physport:r.physport,priority:r.priority,static_addressing:{address:d(r[`static-addressing-address`],`static-addressing-address`,`text`),gateway_address:d(r[`static-addressing-gateway-address`],`static-addressing-gateway-address`,`text`),secondary_address:d(r[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`)},vlan_tag:r[`vlan-tag`]});a(await s(`Creating`,async()=>l.magicTransit.sites.wans.create({...p,account_id:f,site_id:r[`site-id`]})),{successLabel:`Created`})}};function ga(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 _a={command:`delete <wan-id>`,describe:`Remove a specific Site WAN.`,builder:ga,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites wans delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${r[`site-id`]==null?`<site-id>`:encodeURIComponent(String(r[`site-id`]))}/wans/${r[`wan-id`]==null?`<wan-id>`:encodeURIComponent(String(r[`wan-id`]))}`,pathParams:{"site-id":String(r[`site-id`]??``),"wan-id":String(r[`wan-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
111
- `);return}a(await s(`Deleting`,async()=>c.magicTransit.sites.wans.delete({account_id:l,site_id:r[`site-id`],wan_id:r[`wan-id`]})),{successLabel:`Deleted`})}};function va(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 ya={command:`edit <wan-id>`,describe:`Patch a specific Site WAN.`,builder:va,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites wans edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${r[`site-id`]==null?`<site-id>`:encodeURIComponent(String(r[`site-id`]))}/wans/${r[`wan-id`]==null?`<wan-id>`:encodeURIComponent(String(r[`wan-id`]))}`,pathParams:{"site-id":String(r[`site-id`]??``),"wan-id":String(r[`wan-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({name:d(r.name,`name`,`text`),physport:r.physport,priority:r.priority,static_addressing:{address:d(r[`static-addressing-address`],`static-addressing-address`,`text`),gateway_address:d(r[`static-addressing-gateway-address`],`static-addressing-gateway-address`,`text`),secondary_address:d(r[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`)},vlan_tag:r[`vlan-tag`]}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.magicTransit.sites.wans.edit({body:e,account_id:f,site_id:r[`site-id`],wan_id:r[`wan-id`]})),{successLabel:`Updated`});return}let p=u({name:d(r.name,`name`,`text`),physport:r.physport,priority:r.priority,static_addressing:{address:d(r[`static-addressing-address`],`static-addressing-address`,`text`),gateway_address:d(r[`static-addressing-gateway-address`],`static-addressing-gateway-address`,`text`),secondary_address:d(r[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`)},vlan_tag:r[`vlan-tag`]});a(await s(`Updating`,async()=>l.magicTransit.sites.wans.edit({body:p,account_id:f,site_id:r[`site-id`],wan_id:r[`wan-id`]})),{successLabel:`Updated`})}};function ba(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 xa={command:`get <wan-id>`,describe:`Get a specific Site WAN.`,builder:ba,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites wans get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${r[`site-id`]==null?`<site-id>`:encodeURIComponent(String(r[`site-id`]))}/wans/${r[`wan-id`]==null?`<wan-id>`:encodeURIComponent(String(r[`wan-id`]))}`,pathParams:{"site-id":String(r[`site-id`]??``),"wan-id":String(r[`wan-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.magicTransit.sites.wans.get({account_id:l,site_id:r[`site-id`],wan_id:r[`wan-id`]})),{successLabel:`Loaded`})}};function Sa(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 Ca={command:`list`,describe:`Lists Site WANs associated with an account.`,builder:Sa,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites wans list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${r[`site-id`]==null?`<site-id>`:encodeURIComponent(String(r[`site-id`]))}/wans`,pathParams:{"site-id":String(r[`site-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.magicTransit.sites.wans.list({account_id:l,site_id:r[`site-id`]})),{successLabel:`Loaded`})}};function wa(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 Ta={command:`update <wan-id>`,describe:`Update a specific Site WAN.`,builder:wa,handler:async r=>{if(r.dryRun){o({command:`cf magic-transit sites wans update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/magic/sites/${r[`site-id`]==null?`<site-id>`:encodeURIComponent(String(r[`site-id`]))}/wans/${r[`wan-id`]==null?`<wan-id>`:encodeURIComponent(String(r[`wan-id`]))}`,pathParams:{"site-id":String(r[`site-id`]??``),"wan-id":String(r[`wan-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({name:d(r.name,`name`,`text`),physport:r.physport,priority:r.priority,static_addressing:{address:d(r[`static-addressing-address`],`static-addressing-address`,`text`),gateway_address:d(r[`static-addressing-gateway-address`],`static-addressing-gateway-address`,`text`),secondary_address:d(r[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`)},vlan_tag:r[`vlan-tag`]}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.magicTransit.sites.wans.update({body:e,account_id:f,site_id:r[`site-id`],wan_id:r[`wan-id`]})),{successLabel:`Updated`});return}let p=u({name:d(r.name,`name`,`text`),physport:r.physport,priority:r.priority,static_addressing:{address:d(r[`static-addressing-address`],`static-addressing-address`,`text`),gateway_address:d(r[`static-addressing-gateway-address`],`static-addressing-gateway-address`,`text`),secondary_address:d(r[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`)},vlan_tag:r[`vlan-tag`]});a(await s(`Updating`,async()=>l.magicTransit.sites.wans.update({body:p,account_id:f,site_id:r[`site-id`],wan_id:r[`wan-id`]})),{successLabel:`Updated`})}},Ea={command:`wans`,describe:`Operations for sites.wans`,builder:e=>e.command(ha).command(_a).command(ya).command(xa).command(Ca).command(Ta).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Da={command:`sites`,describe:`Magic WAN branch sites — base CRUD, LAN/WAN interface configuration, ACLs, connectors, app configuration, and NetFlow config`,builder:e=>e.command(Ni).command(Fi).command(Li).command(zi).command(ea).command(pa).command(bi).command(ji).command(Qi).command(da).command(Ea).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Oa={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(It).command(qt).command(an).command(un).command(yn).command(Rn).command(Zn).command(mr).command(Fr).command(Kr).command(si).command(Da).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Oa as default};