cf 0.1.0 → 0.3.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 (268) hide show
  1. package/dist/_meta/agent-context.json +96 -95
  2. package/dist/_meta/commands.json +16558 -13965
  3. package/dist/_meta/schemas.json +52979 -16753
  4. package/dist/abuse-reports-dMIfUJ8v.mjs +8 -0
  5. package/dist/accounts-Kx1epdA1.mjs +22 -0
  6. package/dist/acm-Utu252kC.mjs +3 -0
  7. package/dist/addressing-CBq7Z7Vq.mjs +12 -0
  8. package/dist/{agent-context-D26woB9J.mjs → agent-context-BGTU299M.mjs} +1 -1
  9. package/dist/ai-DOOKLPkG.mjs +2 -0
  10. package/dist/ai-gateway-Cj1T3avF.mjs +8 -0
  11. package/dist/ai-search-CQF_Sn7d.mjs +7 -0
  12. package/dist/ai_gateway-C3fH22C0.mjs +4 -0
  13. package/dist/alerting-CqmEIaKn.mjs +6 -0
  14. package/dist/analytics-Dv-X8x7D.mjs +20 -0
  15. package/dist/analytics_engine-DdXVR8z2.mjs +2 -0
  16. package/dist/api-gateway-CNv0IHTU.mjs +33 -0
  17. package/dist/argo-CX_A4kcn.mjs +2 -0
  18. package/dist/audit-logs-BfBf3oo-.mjs +2 -0
  19. package/dist/auth-SyWhMmPu.mjs +6 -0
  20. package/dist/auth-ffdf9yR0.mjs +135 -0
  21. package/dist/autorag-BuGhGTeZ.mjs +2 -0
  22. package/dist/billing-PoG81XaQ.mjs +2 -0
  23. package/dist/body-parser-DKa8Ipg1.mjs +2 -0
  24. package/dist/bot-management-CFvtVx62.mjs +5 -0
  25. package/dist/botnet-feed-B-M4Yu0W.mjs +3 -0
  26. package/dist/brand-protection-D05Eg-_6.mjs +3 -0
  27. package/dist/browser-rendering-xu8F_Rrv.mjs +4 -0
  28. package/dist/build-DYkGW4dh.mjs +1054 -0
  29. package/dist/cache-DsoW6Xwv.mjs +5 -0
  30. package/dist/calls-CZbO7TyR.mjs +4 -0
  31. package/dist/certificate-authorities-D2yr7_3t.mjs +2 -0
  32. package/dist/cli-types-CRIDdDw3.mjs +2 -0
  33. package/dist/client-certificates-MJcDsTId.mjs +3 -0
  34. package/dist/cloud-connector-DWOrN2eM.mjs +2 -0
  35. package/dist/cloudforce-one-2Bhz8YdW.mjs +21 -0
  36. package/dist/{completions-BKrxcfhN.mjs → completions-BwRpZQVn.mjs} +1 -1
  37. package/dist/{config-BIfdEY0E.mjs → config-DYzlVxcB.mjs} +1 -1
  38. package/dist/connectivity-BX8C7tvK.mjs +3 -0
  39. package/dist/content-scanning-r6uzMO1r.mjs +4 -0
  40. package/dist/context-DGlHRGWM.mjs +2 -0
  41. package/dist/custom-certificates-aAiEguR7.mjs +5 -0
  42. package/dist/custom-hostnames-AG5yBHIi.mjs +5 -0
  43. package/dist/custom-nameservers-D1DtlRue.mjs +3 -0
  44. package/dist/custom-pages-DQCi2plU.mjs +4 -0
  45. package/dist/d1-DbnYhw45.mjs +4 -0
  46. package/dist/data-security-D_EtYBfo.mjs +6 -0
  47. package/dist/dcv-delegation-CHspSzTI.mjs +2 -0
  48. package/dist/delegate.mjs +1 -1
  49. package/dist/deploy-CQial3kN.mjs +2 -0
  50. package/dist/{dev-BfKYB-R_.mjs → dev-B38LfCTl.mjs} +1 -1
  51. package/dist/diagnostics-BJQGjVJn.mjs +3 -0
  52. package/dist/dispatch-namespaces-DmHvoBOg.mjs +7 -0
  53. package/dist/{dist-C_bu5HwZ.mjs → dist-AIcZFk0U.mjs} +7 -7
  54. package/dist/dist-DNBSHor6.mjs +301 -0
  55. package/dist/dns-VMhQSr5n.mjs +29 -0
  56. package/dist/dns-firewall-B4DVXFBQ.mjs +57 -0
  57. package/dist/durable-objects-CTboySEo.mjs +2 -0
  58. package/dist/email-routing-tIR2SFu-.mjs +10 -0
  59. package/dist/email-security-Ca1id3rZ.mjs +8 -0
  60. package/dist/email-sending-DwWKc5jC.mjs +3 -0
  61. package/dist/filters-A4dg_a68.mjs +4 -0
  62. package/dist/firewall-DWPQgYd9.mjs +11 -0
  63. package/dist/fraud-BMkSsJGU.mjs +20 -0
  64. package/dist/google-tag-gateway-BGD49nRC.mjs +2 -0
  65. package/dist/healthchecks-CtIfrFql.mjs +4 -0
  66. package/dist/hostnames-BiomxukN.mjs +3 -0
  67. package/dist/hyperdrive-Da104VaQ.mjs +18 -0
  68. package/dist/iam-BIGKo0WW.mjs +6 -0
  69. package/dist/images-BO8FbDAa.mjs +5 -0
  70. package/dist/index.mjs +1 -1
  71. package/dist/intel-CY6_79v8.mjs +3 -0
  72. package/dist/{ips-B0cK7D0_.mjs → ips-K4bzaGqd.mjs} +1 -1
  73. package/dist/keyless-certificates-CZC-L8gM.mjs +3 -0
  74. package/dist/kv-8o27w_pY.mjs +5 -0
  75. package/dist/leaked-credential-checks-qLzRyu85.mjs +3 -0
  76. package/dist/load-balancers-DtG8nj25.mjs +6 -0
  77. package/dist/logpush-4L0njy1d.mjs +4 -0
  78. package/dist/logs-B_Yp95hv.mjs +3 -0
  79. package/dist/magic-cloud-networking-CSOM3EM-.mjs +5 -0
  80. package/dist/magic-network-monitoring-BnwvM4-I.mjs +4 -0
  81. package/dist/magic-transit-CXDyvhxq.mjs +90 -0
  82. package/dist/managed-transforms-D15yVbZx.mjs +3 -0
  83. package/dist/mtls-certificates-D8k0AXWK.mjs +3 -0
  84. package/dist/network-interconnects-rrr7red3.mjs +36 -0
  85. package/dist/observability-DWvpqnQJ.mjs +4 -0
  86. package/dist/organizations-T77D50Sq.mjs +41 -0
  87. package/dist/origin-ca-certificates-DXIvD8H5.mjs +3 -0
  88. package/dist/origin-post-quantum-encryption-C8oOczyV.mjs +2 -0
  89. package/dist/origin-tls-client-auth-CaVW1Ztp.mjs +4 -0
  90. package/dist/output-BJFNwj7b.mjs +2 -0
  91. package/dist/page-rules-CjZPTMQX.mjs +18 -0
  92. package/dist/page-shield-D5RRNJCY.mjs +37 -0
  93. package/dist/pages-CWJtJnL0.mjs +11 -0
  94. package/dist/pipelines-B0L_7j9e.mjs +6 -0
  95. package/dist/{progress-DZfTxbrx.mjs → progress-CrCGTq7N.mjs} +1 -1
  96. package/dist/queues-CN6DPhRR.mjs +6 -0
  97. package/dist/r2-DQIcyRtA.mjs +21 -0
  98. package/dist/r2-data-catalog-Bbo93TJx.mjs +14 -0
  99. package/dist/radar-Bxb0WX8V.mjs +2 -0
  100. package/dist/rate-limits-DcrQV6Ar.mjs +5 -0
  101. package/dist/raw-fetch-Dlccg0Tr.mjs +2 -0
  102. package/dist/realtime-kit-CaquuVOE.mjs +18 -0
  103. package/dist/registrar-Ko-xZemf.mjs +46 -0
  104. package/dist/request-tracers-DOW_reTJ.mjs +2 -0
  105. package/dist/{resolve-BuJRWSk0.mjs → resolve-4-OSeHlK.mjs} +1 -1
  106. package/dist/resource-sharing-D7TX0JV0.mjs +5 -0
  107. package/dist/resource-tagging-C3qtLzCz.mjs +16 -0
  108. package/dist/rules-BXRADHL5.mjs +4 -0
  109. package/dist/rulesets-CBgpeSvJ.mjs +8 -0
  110. package/dist/rum-BjPptTUP.mjs +4 -0
  111. package/dist/{schema-D0_cbcDt.mjs → schema-D16TgWBg.mjs} +1 -1
  112. package/dist/schema-validation-Dgv_opM3.mjs +24 -0
  113. package/dist/scim-DdSEr4kZ.mjs +3 -0
  114. package/dist/secrets-store-7BfyvJLb.mjs +25 -0
  115. package/dist/security-center-DAy6AKtT.mjs +2 -0
  116. package/dist/security-txt-xAMb7K6Y.mjs +3 -0
  117. package/dist/session-COHHdS7A.mjs +5 -0
  118. package/dist/shared-AGtpXwwL.mjs +2 -0
  119. package/dist/smart-shield-TeWZFnH2.mjs +3 -0
  120. package/dist/snippets-CCSsCXVs.mjs +4 -0
  121. package/dist/{spawn-D_cjG87Z.mjs → spawn-DcppKGI5.mjs} +1 -1
  122. package/dist/spectrum-CTTZID8u.mjs +63 -0
  123. package/dist/speed-CuzTE0AL.mjs +4 -0
  124. package/dist/{src-C5qivNKH.mjs → src-BW6vfAwE.mjs} +15 -15
  125. package/dist/ssl-BWA2LdwC.mjs +15 -0
  126. package/dist/stream-GFsIZ-pP.mjs +14 -0
  127. package/dist/tenants-Bd7NGQ_m.mjs +2 -0
  128. package/dist/token-validation-DAgtFOvs.mjs +10 -0
  129. package/dist/{tools-CtKbk6VS.mjs → tools-DXQmfFuE.mjs} +1 -1
  130. package/dist/turnstile-cfdaO4ca.mjs +23 -0
  131. package/dist/{ui-mP_arYIg.mjs → ui-D4KtlMh9.mjs} +1 -1
  132. package/dist/url-normalization-B5RN4nLD.mjs +3 -0
  133. package/dist/url-scanner-BrZ1L9OC.mjs +2 -0
  134. package/dist/user-CAo-yCJA.mjs +10 -0
  135. package/dist/vectorize-C7_oQlaI.mjs +4 -0
  136. package/dist/versions-CUwWJWmy.mjs +2 -0
  137. package/dist/waiting-rooms-Dln5ICg5.mjs +11 -0
  138. package/dist/web3-HQJRm38W.mjs +4 -0
  139. package/dist/workers-Dg7ddG2Q.mjs +18 -0
  140. package/dist/workers-builds-AVfx8IyL.mjs +7 -0
  141. package/dist/workflows-VquuSh2J.mjs +4 -0
  142. package/dist/zaraz-xYSWIV4P.mjs +2 -0
  143. package/dist/zero-trust-CP96wnSh.mjs +118 -0
  144. package/dist/zones-BSgmZ9WC.mjs +21 -0
  145. package/package.json +7 -6
  146. package/dist/abuse-reports-ChV_yD7f.mjs +0 -8
  147. package/dist/accounts-BCYecXFh.mjs +0 -21
  148. package/dist/acm-DD8zSds2.mjs +0 -3
  149. package/dist/addressing-D4Eqw5Bi.mjs +0 -13
  150. package/dist/ai-DfXMOMx_.mjs +0 -2
  151. package/dist/ai-gateway-DdRFthMo.mjs +0 -8
  152. package/dist/ai-search-C_68CDj1.mjs +0 -7
  153. package/dist/alerting-DbhqhVCp.mjs +0 -6
  154. package/dist/analytics-BSBBc7ep.mjs +0 -20
  155. package/dist/api-gateway-CZ4swbkQ.mjs +0 -33
  156. package/dist/argo-tms9ZwHO.mjs +0 -2
  157. package/dist/audit-logs-24qyW8cl.mjs +0 -2
  158. package/dist/auth-BlSmtIKd.mjs +0 -112
  159. package/dist/auth-DQ8miey6.mjs +0 -6
  160. package/dist/autorag-kgNt06GD.mjs +0 -2
  161. package/dist/billing-lwBHNTXC.mjs +0 -2
  162. package/dist/body-parser-Br-BoYk-.mjs +0 -2
  163. package/dist/bot-management-LKf7BqUr.mjs +0 -5
  164. package/dist/botnet-feed-nQ-gErTS.mjs +0 -3
  165. package/dist/brand-protection-DOKv9GRr.mjs +0 -3
  166. package/dist/browser-rendering-CBExtgGt.mjs +0 -4
  167. package/dist/build-C_48VvoK.mjs +0 -1056
  168. package/dist/builds-C_ySULja.mjs +0 -2
  169. package/dist/cache-BBiiNZHP.mjs +0 -5
  170. package/dist/calls-DA5Xzwev.mjs +0 -4
  171. package/dist/certificate-authorities-sXyR_yGp.mjs +0 -2
  172. package/dist/client-certificates-tV0aCLQJ.mjs +0 -3
  173. package/dist/cloud-connector-DZfHcSso.mjs +0 -2
  174. package/dist/cloudforce-one-y1PgQmI9.mjs +0 -21
  175. package/dist/connectivity-8SOqaFDn.mjs +0 -3
  176. package/dist/content-scanning-B9y6K_G5.mjs +0 -4
  177. package/dist/context-DTIbtQn5.mjs +0 -2
  178. package/dist/custom-certificates-sWksR8Ys.mjs +0 -5
  179. package/dist/custom-hostnames-91QZkdqN.mjs +0 -5
  180. package/dist/custom-nameservers-DajZaZvE.mjs +0 -3
  181. package/dist/custom-pages-Cu7gmwzT.mjs +0 -4
  182. package/dist/d1-H_VRsVmF.mjs +0 -3
  183. package/dist/dcv-delegation-C-qhEYEZ.mjs +0 -2
  184. package/dist/deploy--9wYOkHg.mjs +0 -2
  185. package/dist/diagnostics-D2B2LPZZ.mjs +0 -3
  186. package/dist/dispatch-namespaces-CyrXBU_w.mjs +0 -7
  187. package/dist/dist-DvKjT2TT.mjs +0 -303
  188. package/dist/dns-Bn9Uz_Nj.mjs +0 -29
  189. package/dist/dns-firewall-BslP4p-j.mjs +0 -57
  190. package/dist/durable-objects-BN1ZnHhm.mjs +0 -2
  191. package/dist/email-routing-n2TnTaRR.mjs +0 -10
  192. package/dist/email-security-C9SEx0kh.mjs +0 -60
  193. package/dist/email-sending-DayZ7u3I.mjs +0 -3
  194. package/dist/filters-CI_XTgfQ.mjs +0 -4
  195. package/dist/firewall-CcaayGig.mjs +0 -11
  196. package/dist/fraud-Cr7aPCV8.mjs +0 -8
  197. package/dist/google-tag-gateway-B3GpYgQ4.mjs +0 -2
  198. package/dist/healthchecks-CVTsR_OC.mjs +0 -4
  199. package/dist/hostnames-Bd_Wa5l6.mjs +0 -3
  200. package/dist/hyperdrive-BBJhEDZd.mjs +0 -18
  201. package/dist/iam-D_FN0pDF.mjs +0 -6
  202. package/dist/images-CAP2hAlZ.mjs +0 -5
  203. package/dist/intel-CkxfzqmJ.mjs +0 -3
  204. package/dist/keyless-certificates-LcLmHZsX.mjs +0 -3
  205. package/dist/kv-_TkUQ6fs.mjs +0 -5
  206. package/dist/leaked-credential-checks-Dhvaen22.mjs +0 -3
  207. package/dist/load-balancers-Ckr0UIpk.mjs +0 -6
  208. package/dist/logpush-Cj946hxT.mjs +0 -4
  209. package/dist/logs-DgC9hjvJ.mjs +0 -3
  210. package/dist/magic-cloud-networking-WbDvPzuG.mjs +0 -5
  211. package/dist/magic-network-monitoring-BcHShvGQ.mjs +0 -4
  212. package/dist/magic-transit-B8sCOkt_.mjs +0 -89
  213. package/dist/managed-transforms-BpOr-8HY.mjs +0 -3
  214. package/dist/mtls-certificates-fOul8D5g.mjs +0 -3
  215. package/dist/network-interconnects-BSW65xlh.mjs +0 -36
  216. package/dist/organizations-T4vKGFAb.mjs +0 -41
  217. package/dist/origin-ca-certificates-ChM0lZ64.mjs +0 -3
  218. package/dist/origin-post-quantum-encryption-C7o26ARh.mjs +0 -2
  219. package/dist/origin-tls-client-auth-D32dpZk_.mjs +0 -5
  220. package/dist/output-D7_yAFVR.mjs +0 -2
  221. package/dist/page-rules-RFoj8CjN.mjs +0 -18
  222. package/dist/page-shield-VTktzKDN.mjs +0 -37
  223. package/dist/pages-L1ITjXDZ.mjs +0 -10
  224. package/dist/pipelines-BPO0Lnil.mjs +0 -6
  225. package/dist/queues-B0C06L9r.mjs +0 -6
  226. package/dist/r2-DP020Tmq.mjs +0 -21
  227. package/dist/r2-data-catalog-Dmipvz5F.mjs +0 -14
  228. package/dist/radar-DR3VMknH.mjs +0 -2
  229. package/dist/rate-limits-DnHPBPgU.mjs +0 -5
  230. package/dist/raw-fetch-DlXYwVA8.mjs +0 -2
  231. package/dist/realtime-kit-C430aq2d.mjs +0 -6
  232. package/dist/registrar-7Qy50zbW.mjs +0 -46
  233. package/dist/request-tracers-sv99NDIl.mjs +0 -2
  234. package/dist/resource-sharing-uEjC7lnQ.mjs +0 -5
  235. package/dist/resource-tagging-CiODdP3N.mjs +0 -16
  236. package/dist/rules-FXAyTrwk.mjs +0 -4
  237. package/dist/rulesets-B6aUsFFB.mjs +0 -8
  238. package/dist/rum-CyyGJhp5.mjs +0 -4
  239. package/dist/schema-validation-ByU49h--.mjs +0 -4
  240. package/dist/scim-DdTS65_C.mjs +0 -3
  241. package/dist/scm-CilfPOue.mjs +0 -2
  242. package/dist/secrets-store-ClOUVhBJ.mjs +0 -18
  243. package/dist/security-center-4iSBqTrf.mjs +0 -2
  244. package/dist/security-txt-kGxdkDY6.mjs +0 -3
  245. package/dist/session-mW-s8ghP.mjs +0 -2
  246. package/dist/smart-shield-B-SQd2Qp.mjs +0 -3
  247. package/dist/snippets-Aq58ojqw.mjs +0 -4
  248. package/dist/spectrum-0gFvGI6y.mjs +0 -59
  249. package/dist/speed-DAZU8w3T.mjs +0 -4
  250. package/dist/ssl-BRlXa-5w.mjs +0 -15
  251. package/dist/stream-BAxsVeBX.mjs +0 -14
  252. package/dist/tenants-Df6xDqoA.mjs +0 -2
  253. package/dist/token-validation-pO4dCjCy.mjs +0 -4
  254. package/dist/turnstile-B1dmO8wE.mjs +0 -23
  255. package/dist/url-normalization-sUDVmrUt.mjs +0 -3
  256. package/dist/url-scanner-CwOKRkYo.mjs +0 -2
  257. package/dist/user-D_UrIdNq.mjs +0 -10
  258. package/dist/vectorize-BEbBn9G9.mjs +0 -4
  259. package/dist/vuln-scanner-Br_2lQp1.mjs +0 -2
  260. package/dist/waiting-rooms-BQC-urV4.mjs +0 -11
  261. package/dist/web3-CIH2iQeX.mjs +0 -4
  262. package/dist/workers-B9EvrpH3.mjs +0 -16
  263. package/dist/workers-builds-DzWSiRd2.mjs +0 -7
  264. package/dist/workflows-aD81gA4k.mjs +0 -4
  265. package/dist/zaraz-Cg1dsvrZ.mjs +0 -2
  266. package/dist/zero-trust-D-xQXWcy.mjs +0 -119
  267. package/dist/zones-DQzucJDd.mjs +0 -28
  268. /package/dist/{metadata-DGdCpUxn.mjs → metadata-5VwHPW6C.mjs} +0 -0
@@ -0,0 +1,90 @@
1
+ #!/usr/bin/env node
2
+ import{C as e,D as t,E as n,T as r,_ as i,i as a,n as o}from"./auth-ffdf9yR0.mjs";import{n as s,r as c,t as l}from"./body-parser-DKa8Ipg1.mjs";import{t as u}from"./output-BJFNwj7b.mjs";import{n as d,t as f}from"./progress-CrCGTq7N.mjs";import{n as p}from"./input-validation-zEO81MWN.mjs";import{t as m}from"./local-VJaJ3BZ1.mjs";import{t as h}from"./cli-types-CRIDdDw3.mjs";import{n as g,t as _}from"./raw-fetch-Dlccg0Tr.mjs";function ee(e){return e.option(`burst-sensitivity`,{type:`string`,description:`The burst sensitivity. Must be one of 'low', 'medium', 'high'.`}).option(`mode`,{type:`string`,description:`The mode for DNS Protection. Must be one of 'enabled', 'disabled', 'monitoring'.`}).option(`name`,{type:`string`,description:`The name of the DNS Protection rule. Value is relative to the 'scope' setting. For 'global' scope, name should be 'global'. For either the 'region' or 'datacenter' scope, name should be the actual name of the region or datacenter, e.g., 'wnam' or 'lax'.`}).option(`profile-sensitivity`,{type:`string`,description:`The profile sensitivity. Recommended setting is 'low'. Must be one of 'low', 'medium', 'high', or 'very_high'.`}).option(`rate-sensitivity`,{type:`string`,description:`The rate sensitivity. Must be one of 'low', 'medium', 'high'.`}).option(`scope`,{type:`string`,description:`The scope for the DNS Protection rule. Must be one of 'global', 'region', or 'datacenter'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The new DNS Protection rule to add.`})}const te={command:`create`,describe:`Create a DNS Protection rule for an account.`,builder:ee,handler:async n=>{if(n.dryRun){d({command:`cf magic-transit advanced-dns-protection configs dns protection rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_dns_protection/configs/dns_protection/rules`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({burst_sensitivity:p(n[`burst-sensitivity`],`burst-sensitivity`,`text`),mode:p(n.mode,`mode`,`text`),name:p(n.name,`name`,`text`),profile_sensitivity:p(n[`profile-sensitivity`],`profile-sensitivity`,`text`),rate_sensitivity:p(n[`rate-sensitivity`],`rate-sensitivity`,`text`),scope:p(n.scope,`scope`,`text`)}):s(n.body)});return}let r=await o(n),a=n.local?m:await i(r);if(n.accountId=a,n.body){let e=s(n.body);u(await f(`Creating`,async()=>r.magicTransit.advancedDnsProtection.configs.dns.protection.rules.create({...e,account_id:a})),{successLabel:`Created`});return}n[`burst-sensitivity`]===void 0&&(n[`burst-sensitivity`]=await t(`burst-sensitivity`,`The burst sensitivity. Must be one of 'low', 'medium', 'high'.`)),n.mode===void 0&&(n.mode=await t(`mode`,`The mode for DNS Protection. Must be one of 'enabled', 'disabled', 'monitoring'.`)),n.name===void 0&&(n.name=await t(`name`,`The name of the DNS Protection rule. Value is relative to the 'scope' setting. For 'global' scope, name should be 'global'. For either the 'region' or 'datacenter' scope, name should be the actual name of the region or datacenter, e.g., 'wnam' or 'lax'.`)),n[`profile-sensitivity`]===void 0&&(n[`profile-sensitivity`]=await t(`profile-sensitivity`,`The profile sensitivity. Recommended setting is 'low'. Must be one of 'low', 'medium', 'high', or 'very_high'.`)),n[`rate-sensitivity`]===void 0&&(n[`rate-sensitivity`]=await t(`rate-sensitivity`,`The rate sensitivity. Must be one of 'low', 'medium', 'high'.`)),n.scope===void 0&&(n.scope=await t(`scope`,`The scope for the DNS Protection rule. Must be one of 'global', 'region', or 'datacenter'.`));let c=l({burst_sensitivity:p(n[`burst-sensitivity`],`burst-sensitivity`,`text`),mode:p(n.mode,`mode`,`text`),name:p(n.name,`name`,`text`),profile_sensitivity:p(n[`profile-sensitivity`],`profile-sensitivity`,`text`),rate_sensitivity:p(n[`rate-sensitivity`],`rate-sensitivity`,`text`),scope:p(n.scope,`scope`,`text`)});u(await f(`Creating`,async()=>r.magicTransit.advancedDnsProtection.configs.dns.protection.rules.create({...c,account_id:a})),{successLabel:`Created`})}};function v(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 y={command:`account`,describe:`Delete all DNS Protection rules for an account.`,builder:v,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit advanced-dns-protection configs dns protection rules delete for account`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_dns_protection/configs/dns_protection/rules`,pathParams:{},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
3
+ `);return}u(await f(`Deleting`,async()=>n.magicTransit.advancedDnsProtection.configs.dns.protection.rules.delete.for.account({account_id:a})),{successLabel:`Deleted`})}},b={command:`for`,describe:`Advanced Dns Protection operations`,builder:e=>e.command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function x(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 S={command:`rule <rule-id>`,describe:`Delete a DNS Protection rule specified by the given UUID.`,builder:x,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit advanced-dns-protection configs dns protection rules delete protection rule`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_dns_protection/configs/dns_protection/rules/${t[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(t[`rule-id`]))}`,pathParams:{"rule-id":String(t[`rule-id`]??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
4
+ `);return}u(await f(`Deleting`,async()=>n.magicTransit.advancedDnsProtection.configs.dns.protection.rules.delete.protection.rule({account_id:a,rule_id:t[`rule-id`]})),{successLabel:`Deleted`})}},C={command:`protection`,describe:`Advanced Dns Protection operations`,builder:e=>e.command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},w={command:`delete`,describe:`Operations for advanced-dns-protection.configs.dns.protection.rules.delete`,builder:e=>e.command(b).command(C).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function T(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 E={command:`get <rule-id>`,describe:`Get a DNS Protection rule specified by the given UUID.`,builder:T,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit advanced-dns-protection configs dns protection rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_dns_protection/configs/dns_protection/rules/${t[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(t[`rule-id`]))}`,pathParams:{"rule-id":String(t[`rule-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,u(await f(`Loading`,async()=>n.magicTransit.advancedDnsProtection.configs.dns.protection.rules.get({account_id:r,rule_id:t[`rule-id`]})),{successLabel:`Loaded`})}};function D(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 O={command:`list`,describe:`List all DNS Protection rules for an account.`,builder:D,handler:async t=>{let n={page:t.page,per_page:t[`per-page`],order:t.order,direction:t.direction};if(t.dryRun){d({command:`cf magic-transit advanced-dns-protection configs dns protection rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_dns_protection/configs/dns_protection/rules`,pathParams:{},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?m:await i(r);t.accountId=a,u(await f(`Loading`,async()=>r.magicTransit.advancedDnsProtection.configs.dns.protection.rules.list({account_id:a,...n})),{successLabel:`Loaded`})}};function k(e){return e.positional(`rule-id`,{type:`string`,description:`The UUID of the DNS Protection rule to update.`,demandOption:!0}).option(`burst-sensitivity`,{type:`string`,description:`The new burst sensitivity. Optional. Must be one of 'low', 'medium', 'high'.`}).option(`mode`,{type:`string`,description:`The new mode for DNS Protection. Optional. Must be one of 'enabled', 'disabled', 'monitoring'.`}).option(`profile-sensitivity`,{type:`string`,description:`The new profile sensitivity. Optional. Recommended setting is 'low'. Must be one of 'low', 'medium', 'high', or 'very_high'.`}).option(`rate-sensitivity`,{type:`string`,description:`The new rate sensitivity. Optional. Must be one of 'low', 'medium', 'high'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The updates to apply to the DNS Protection rule.`})}const A={command:`update <rule-id>`,describe:`Update a DNS Protection rule specified by the given UUID.`,builder:k,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit advanced-dns-protection configs dns protection rules update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_dns_protection/configs/dns_protection/rules/${t[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(t[`rule-id`]))}`,pathParams:{"rule-id":String(t[`rule-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({burst_sensitivity:p(t[`burst-sensitivity`],`burst-sensitivity`,`text`),mode:p(t.mode,`mode`,`text`),profile_sensitivity:p(t[`profile-sensitivity`],`profile-sensitivity`,`text`),rate_sensitivity:p(t[`rate-sensitivity`],`rate-sensitivity`,`text`)}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Updating`,async()=>n.magicTransit.advancedDnsProtection.configs.dns.protection.rules.update({...e,account_id:r,rule_id:t[`rule-id`]})),{successLabel:`Updated`});return}let a=l({burst_sensitivity:p(t[`burst-sensitivity`],`burst-sensitivity`,`text`),mode:p(t.mode,`mode`,`text`),profile_sensitivity:p(t[`profile-sensitivity`],`profile-sensitivity`,`text`),rate_sensitivity:p(t[`rate-sensitivity`],`rate-sensitivity`,`text`)});u(await f(`Updating`,async()=>n.magicTransit.advancedDnsProtection.configs.dns.protection.rules.update({...a,account_id:r,rule_id:t[`rule-id`]})),{successLabel:`Updated`})}},j={command:`rules`,describe:`Advanced Dns Protection operations`,builder:e=>e.command(te).command(E).command(O).command(A).command(w).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},M={command:`protection`,describe:`Operations for advanced-dns-protection.configs.dns.protection`,builder:e=>e.command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},N={command:`dns`,describe:`Operations for advanced-dns-protection.configs.dns`,builder:e=>e.command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},P={command:`configs`,describe:`Operations for advanced-dns-protection.configs`,builder:e=>e.command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},F={command:`advanced-dns-protection`,describe:`Operations for advanced-dns-protection`,builder:e=>e.command(P).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function I(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 L={command:`create`,describe:`Create an allowlist prefix for an account.`,builder:I,handler:async n=>{if(n.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs allowlist create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/allowlist`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({comment:p(n.comment,`comment`,`text`),enabled:n.enabled,prefix:p(n.prefix,`prefix`,`text`)}):s(n.body)});return}let r=await o(n),a=n.local?m:await i(r);if(n.accountId=a,n.body){let e=s(n.body);u(await f(`Creating`,async()=>r.magicTransit.advancedTcpProtection.configs.allowlist.create({...e,account_id:a})),{successLabel:`Created`});return}if(n.comment===void 0&&(n.comment=await t(`comment`,`An comment describing the allowlist prefix.`)),n.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);n.prefix===void 0&&(n.prefix=await t(`prefix`,`The allowlist prefix to add in CIDR format.`));let c=l({comment:p(n.comment,`comment`,`text`),enabled:n.enabled,prefix:p(n.prefix,`prefix`,`text`)});u(await f(`Creating`,async()=>r.magicTransit.advancedTcpProtection.configs.allowlist.create({...c,account_id:a})),{successLabel:`Created`})}};function R(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 z={command:`prefix <prefix-id>`,describe:`Delete the allowlist prefix for an account given a UUID.`,builder:R,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs allowlist delete allowlist prefix`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/allowlist/${t[`prefix-id`]==null?`<prefix-id>`:encodeURIComponent(String(t[`prefix-id`]))}`,pathParams:{"prefix-id":String(t[`prefix-id`]??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
5
+ `);return}u(await f(`Deleting`,async()=>n.magicTransit.advancedTcpProtection.configs.allowlist.delete.allowlist.prefix({account_id:a,prefix_id:t[`prefix-id`]})),{successLabel:`Deleted`})}},B={command:`allowlist`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function V(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 H={command:`account`,describe:`Delete all allowlist prefixes for an account.`,builder:V,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs allowlist delete for account`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/allowlist`,pathParams:{},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
6
+ `);return}u(await f(`Deleting`,async()=>n.magicTransit.advancedTcpProtection.configs.allowlist.delete.for.account({account_id:a})),{successLabel:`Deleted`})}},U={command:`for`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},W={command:`delete`,describe:`Operations for advanced-tcp-protection.configs.allowlist.delete`,builder:e=>e.command(B).command(U).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function G(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 K={command:`get <prefix-id>`,describe:`Get an allowlist prefix specified by the given UUID.`,builder:G,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs allowlist get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/allowlist/${t[`prefix-id`]==null?`<prefix-id>`:encodeURIComponent(String(t[`prefix-id`]))}`,pathParams:{"prefix-id":String(t[`prefix-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,u(await f(`Loading`,async()=>n.magicTransit.advancedTcpProtection.configs.allowlist.get({account_id:r,prefix_id:t[`prefix-id`]})),{successLabel:`Loaded`})}};function q(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 J={command:`list`,describe:`List all allowlist prefixes for an account.`,builder:q,handler:async t=>{let n={page:t.page,per_page:t[`per-page`],order:t.order,direction:t.direction};if(t.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs allowlist list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/allowlist`,pathParams:{},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?m:await i(r);t.accountId=a,u(await f(`Loading`,async()=>r.magicTransit.advancedTcpProtection.configs.allowlist.list({account_id:a,...n})),{successLabel:`Loaded`})}};function Y(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 X={command:`update <prefix-id>`,describe:`Update an allowlist prefix specified by the given UUID.`,builder:Y,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs allowlist update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/allowlist/${t[`prefix-id`]==null?`<prefix-id>`:encodeURIComponent(String(t[`prefix-id`]))}`,pathParams:{"prefix-id":String(t[`prefix-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({comment:p(t.comment,`comment`,`text`),enabled:t.enabled}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Updating`,async()=>n.magicTransit.advancedTcpProtection.configs.allowlist.update({...e,account_id:r,prefix_id:t[`prefix-id`]})),{successLabel:`Updated`});return}let a=l({comment:p(t.comment,`comment`,`text`),enabled:t.enabled});u(await f(`Updating`,async()=>n.magicTransit.advancedTcpProtection.configs.allowlist.update({...a,account_id:r,prefix_id:t[`prefix-id`]})),{successLabel:`Updated`})}},Z={command:`allowlist`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(L).command(K).command(J).command(X).command(W).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Q(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 ne={command:`create`,describe:`Create multiple prefixes for an account.`,builder:Q,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs prefixes bulk create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/prefixes/bulk`,pathParams:{},bodyKind:`json`,body:t.body===void 0?void 0:s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Creating`,async()=>n.magicTransit.advancedTcpProtection.configs.prefixes.bulk.create({body:e,account_id:r})),{successLabel:`Created`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},re={command:`bulk`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(ne).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ie(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 ae={command:`create`,describe:`Create a prefix for an account.`,builder:ie,handler:async n=>{if(n.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs prefixes create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/prefixes`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({comment:p(n.comment,`comment`,`text`),excluded:n.excluded,prefix:p(n.prefix,`prefix`,`text`)}):s(n.body)});return}let r=await o(n),a=n.local?m:await i(r);if(n.accountId=a,n.body){let e=s(n.body);u(await f(`Creating`,async()=>r.magicTransit.advancedTcpProtection.configs.prefixes.create({body:e,account_id:a})),{successLabel:`Created`});return}if(n.comment===void 0&&(n.comment=await t(`comment`,`A comment describing the prefix.`)),n.excluded===void 0)throw Error(`--excluded is required (or pass --body with this field set).`);n.prefix===void 0&&(n.prefix=await t(`prefix`,`The prefix to add in CIDR format.`));let c=l({comment:p(n.comment,`comment`,`text`),excluded:n.excluded,prefix:p(n.prefix,`prefix`,`text`)});u(await f(`Creating`,async()=>r.magicTransit.advancedTcpProtection.configs.prefixes.create({body:c,account_id:a})),{successLabel:`Created`})}};function oe(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 se={command:`account`,describe:`Delete all prefixes for an account.`,builder:oe,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs prefixes delete for account`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/prefixes`,pathParams:{},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
7
+ `);return}u(await f(`Deleting`,async()=>n.magicTransit.advancedTcpProtection.configs.prefixes.delete.for.account({account_id:a})),{successLabel:`Deleted`})}},ce={command:`for`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function le(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 ue={command:`prefix <prefix-id>`,describe:`Delete the prefix for an account given a UUID.`,builder:le,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs prefixes delete prefix`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/prefixes/${t[`prefix-id`]==null?`<prefix-id>`:encodeURIComponent(String(t[`prefix-id`]))}`,pathParams:{"prefix-id":String(t[`prefix-id`]??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
8
+ `);return}u(await f(`Deleting`,async()=>n.magicTransit.advancedTcpProtection.configs.prefixes.delete.prefix({account_id:a,prefix_id:t[`prefix-id`]})),{successLabel:`Deleted`})}},de={command:`delete`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(ue).command(ce).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function fe(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 pe={command:`get <prefix-id>`,describe:`Get a prefix specified by the given UUID.`,builder:fe,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs prefixes get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/prefixes/${t[`prefix-id`]==null?`<prefix-id>`:encodeURIComponent(String(t[`prefix-id`]))}`,pathParams:{"prefix-id":String(t[`prefix-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,u(await f(`Loading`,async()=>n.magicTransit.advancedTcpProtection.configs.prefixes.get({account_id:r,prefix_id:t[`prefix-id`]})),{successLabel:`Loaded`})}};function me(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 prefixes for an account.`,builder:me,handler:async t=>{let n={page:t.page,per_page:t[`per-page`],order:t.order,direction:t.direction};if(t.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs prefixes list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/prefixes`,pathParams:{},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?m:await i(r);t.accountId=a,u(await f(`Loading`,async()=>r.magicTransit.advancedTcpProtection.configs.prefixes.list({account_id:a,...n})),{successLabel:`Loaded`})}};function ge(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 _e={command:`update <prefix-id>`,describe:`Update a prefix specified by the given UUID.`,builder:ge,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs prefixes update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/prefixes/${t[`prefix-id`]==null?`<prefix-id>`:encodeURIComponent(String(t[`prefix-id`]))}`,pathParams:{"prefix-id":String(t[`prefix-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({comment:p(t.comment,`comment`,`text`),excluded:t.excluded}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Updating`,async()=>n.magicTransit.advancedTcpProtection.configs.prefixes.update({...e,account_id:r,prefix_id:t[`prefix-id`]})),{successLabel:`Updated`});return}let a=l({comment:p(t.comment,`comment`,`text`),excluded:t.excluded});u(await f(`Updating`,async()=>n.magicTransit.advancedTcpProtection.configs.prefixes.update({...a,account_id:r,prefix_id:t[`prefix-id`]})),{successLabel:`Updated`})}},ve={command:`prefixes`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(ae).command(pe).command(he).command(_e).command(re).command(de).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ye(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 be={command:`create`,describe:`Create a SYN Protection filter for an account.`,builder:ye,handler:async n=>{if(n.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs syn protection filters create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/filters`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({expression:p(n.expression,`expression`,`text`),mode:p(n.mode,`mode`,`text`)}):s(n.body)});return}let r=await o(n),a=n.local?m:await i(r);if(n.accountId=a,n.body){let e=s(n.body);u(await f(`Creating`,async()=>r.magicTransit.advancedTcpProtection.configs.syn.protection.filters.create({body:e,account_id:a})),{successLabel:`Created`});return}n.expression===void 0&&(n.expression=await t(`expression`,`The filter expression.`)),n.mode===void 0&&(n.mode=await t(`mode`,`The filter's mode. Must be one of 'enabled', 'disabled', 'monitoring'.`));let c=l({expression:p(n.expression,`expression`,`text`),mode:p(n.mode,`mode`,`text`)});u(await f(`Creating`,async()=>r.magicTransit.advancedTcpProtection.configs.syn.protection.filters.create({body:c,account_id:a})),{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 Se={command:`account`,describe:`Delete all SYN Protection filters for an account.`,builder:xe,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs syn protection filters delete for account`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/filters`,pathParams:{},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
9
+ `);return}u(await f(`Deleting`,async()=>n.magicTransit.advancedTcpProtection.configs.syn.protection.filters.delete.for.account({account_id:a})),{successLabel:`Deleted`})}},Ce={command:`for`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(Se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function we(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 Te={command:`filter <filter-id>`,describe:`Delete a SYN Protection filter specified by the given UUID.`,builder:we,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs syn protection filters delete protection filter`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/filters/${t[`filter-id`]==null?`<filter-id>`:encodeURIComponent(String(t[`filter-id`]))}`,pathParams:{"filter-id":String(t[`filter-id`]??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
10
+ `);return}u(await f(`Deleting`,async()=>n.magicTransit.advancedTcpProtection.configs.syn.protection.filters.delete.protection.filter({account_id:a,filter_id:t[`filter-id`]})),{successLabel:`Deleted`})}},Ee={command:`protection`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(Te).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},De={command:`delete`,describe:`Operations for advanced-tcp-protection.configs.syn.protection.filters.delete`,builder:e=>e.command(Ce).command(Ee).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Oe(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 ke={command:`get <filter-id>`,describe:`Get a SYN Protection filter specified by the given UUID.`,builder:Oe,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs syn protection filters get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/filters/${t[`filter-id`]==null?`<filter-id>`:encodeURIComponent(String(t[`filter-id`]))}`,pathParams:{"filter-id":String(t[`filter-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,u(await f(`Loading`,async()=>n.magicTransit.advancedTcpProtection.configs.syn.protection.filters.get({account_id:r,filter_id:t[`filter-id`]})),{successLabel:`Loaded`})}};function Ae(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 je={command:`list`,describe:`List all SYN Protection filters for an account.`,builder:Ae,handler:async t=>{let n={mode:t.mode,page:t.page,per_page:t[`per-page`],order:t.order,direction:t.direction};if(t.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs syn protection filters list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/filters`,pathParams:{},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?m:await i(r);t.accountId=a,u(await f(`Loading`,async()=>r.magicTransit.advancedTcpProtection.configs.syn.protection.filters.list({account_id:a,...n})),{successLabel:`Loaded`})}};function Me(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 Ne={command:`update <filter-id>`,describe:`Update a SYN Protection filter specified by the given UUID.`,builder:Me,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs syn protection filters update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/filters/${t[`filter-id`]==null?`<filter-id>`:encodeURIComponent(String(t[`filter-id`]))}`,pathParams:{"filter-id":String(t[`filter-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({expression:p(t.expression,`expression`,`text`),mode:p(t.mode,`mode`,`text`)}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Updating`,async()=>n.magicTransit.advancedTcpProtection.configs.syn.protection.filters.update({body:e,account_id:r,filter_id:t[`filter-id`]})),{successLabel:`Updated`});return}let a=l({expression:p(t.expression,`expression`,`text`),mode:p(t.mode,`mode`,`text`)});u(await f(`Updating`,async()=>n.magicTransit.advancedTcpProtection.configs.syn.protection.filters.update({body:a,account_id:r,filter_id:t[`filter-id`]})),{successLabel:`Updated`})}},Pe={command:`filters`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(be).command(ke).command(je).command(Ne).command(De).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Fe(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 Ie={command:`create`,describe:`Create a SYN Protection rule for an account.`,builder:Fe,handler:async n=>{if(n.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs syn protection rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/rules`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({burst_sensitivity:p(n[`burst-sensitivity`],`burst-sensitivity`,`text`),mitigation_type:p(n[`mitigation-type`],`mitigation-type`,`text`),mode:p(n.mode,`mode`,`text`),name:p(n.name,`name`,`text`),rate_sensitivity:p(n[`rate-sensitivity`],`rate-sensitivity`,`text`),scope:p(n.scope,`scope`,`text`)}):s(n.body)});return}let r=await o(n),a=n.local?m:await i(r);if(n.accountId=a,n.body){let e=s(n.body);u(await f(`Creating`,async()=>r.magicTransit.advancedTcpProtection.configs.syn.protection.rules.create({...e,account_id:a})),{successLabel:`Created`});return}n[`burst-sensitivity`]===void 0&&(n[`burst-sensitivity`]=await t(`burst-sensitivity`,`The burst sensitivity. Must be one of 'low', 'medium', 'high'.`)),n.mode===void 0&&(n.mode=await t(`mode`,`The mode for SYN Protection. Must be one of 'enabled', 'disabled', 'monitoring'.`)),n.name===void 0&&(n.name=await t(`name`,`The name of the SYN Protection rule. Value is relative to the 'scope' setting. For 'global' scope, name should be 'global'. For either the 'region' or 'datacenter' scope, name should be the actual name of the region or datacenter, e.g., 'wnam' or 'lax'.`)),n[`rate-sensitivity`]===void 0&&(n[`rate-sensitivity`]=await t(`rate-sensitivity`,`The rate sensitivity. Must be one of 'low', 'medium', 'high'.`)),n.scope===void 0&&(n.scope=await t(`scope`,`The scope for the SYN Protection rule. Must be one of 'global', 'region', or 'datacenter'.`));let c=l({burst_sensitivity:p(n[`burst-sensitivity`],`burst-sensitivity`,`text`),mitigation_type:p(n[`mitigation-type`],`mitigation-type`,`text`),mode:p(n.mode,`mode`,`text`),name:p(n.name,`name`,`text`),rate_sensitivity:p(n[`rate-sensitivity`],`rate-sensitivity`,`text`),scope:p(n.scope,`scope`,`text`)});u(await f(`Creating`,async()=>r.magicTransit.advancedTcpProtection.configs.syn.protection.rules.create({...c,account_id:a})),{successLabel:`Created`})}};function Le(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 Re={command:`account`,describe:`Delete all SYN Protection rules for an account.`,builder:Le,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs syn protection rules delete for account`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/rules`,pathParams:{},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
11
+ `);return}u(await f(`Deleting`,async()=>n.magicTransit.advancedTcpProtection.configs.syn.protection.rules.delete.for.account({account_id:a})),{successLabel:`Deleted`})}},ze={command:`for`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(Re).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Be(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 Ve={command:`rule <rule-id>`,describe:`Delete a SYN Protection rule specified by the given UUID.`,builder:Be,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs syn protection rules delete protection rule`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/rules/${t[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(t[`rule-id`]))}`,pathParams:{"rule-id":String(t[`rule-id`]??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
12
+ `);return}u(await f(`Deleting`,async()=>n.magicTransit.advancedTcpProtection.configs.syn.protection.rules.delete.protection.rule({account_id:a,rule_id:t[`rule-id`]})),{successLabel:`Deleted`})}},He={command:`protection`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(Ve).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ue={command:`delete`,describe:`Operations for advanced-tcp-protection.configs.syn.protection.rules.delete`,builder:e=>e.command(ze).command(He).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function We(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 Ge={command:`get <rule-id>`,describe:`Get a SYN Protection rule specified by the given UUID.`,builder:We,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs syn protection rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/rules/${t[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(t[`rule-id`]))}`,pathParams:{"rule-id":String(t[`rule-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,u(await f(`Loading`,async()=>n.magicTransit.advancedTcpProtection.configs.syn.protection.rules.get({account_id:r,rule_id:t[`rule-id`]})),{successLabel:`Loaded`})}};function Ke(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 qe={command:`list`,describe:`List all SYN Protection rules for an account.`,builder:Ke,handler:async t=>{let n={page:t.page,per_page:t[`per-page`],order:t.order,direction:t.direction};if(t.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs syn protection rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/rules`,pathParams:{},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?m:await i(r);t.accountId=a,u(await f(`Loading`,async()=>r.magicTransit.advancedTcpProtection.configs.syn.protection.rules.list({account_id:a,...n})),{successLabel:`Loaded`})}};function Je(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 Ye={command:`update <rule-id>`,describe:`Update a SYN Protection rule specified by the given UUID.`,builder:Je,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs syn protection rules update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/rules/${t[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(t[`rule-id`]))}`,pathParams:{"rule-id":String(t[`rule-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({burst_sensitivity:p(t[`burst-sensitivity`],`burst-sensitivity`,`text`),mitigation_type:p(t[`mitigation-type`],`mitigation-type`,`text`),mode:p(t.mode,`mode`,`text`),rate_sensitivity:p(t[`rate-sensitivity`],`rate-sensitivity`,`text`)}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Updating`,async()=>n.magicTransit.advancedTcpProtection.configs.syn.protection.rules.update({...e,account_id:r,rule_id:t[`rule-id`]})),{successLabel:`Updated`});return}let a=l({burst_sensitivity:p(t[`burst-sensitivity`],`burst-sensitivity`,`text`),mitigation_type:p(t[`mitigation-type`],`mitigation-type`,`text`),mode:p(t.mode,`mode`,`text`),rate_sensitivity:p(t[`rate-sensitivity`],`rate-sensitivity`,`text`)});u(await f(`Updating`,async()=>n.magicTransit.advancedTcpProtection.configs.syn.protection.rules.update({...a,account_id:r,rule_id:t[`rule-id`]})),{successLabel:`Updated`})}},Xe={command:`rules`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(Ie).command(Ge).command(qe).command(Ye).command(Ue).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ze={command:`protection`,describe:`Operations for advanced-tcp-protection.configs.syn.protection`,builder:e=>e.command(Pe).command(Xe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Qe={command:`syn`,describe:`Operations for advanced-tcp-protection.configs.syn`,builder:e=>e.command(Ze).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function $e(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 et={command:`create`,describe:`Create a TCP Flow Protection filter for an account.`,builder:$e,handler:async n=>{if(n.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection filters create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({expression:p(n.expression,`expression`,`text`),mode:p(n.mode,`mode`,`text`)}):s(n.body)});return}let r=await o(n),a=n.local?m:await i(r);if(n.accountId=a,n.body){let e=s(n.body);u(await f(`Creating`,async()=>r.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.filters.create({body:e,account_id:a})),{successLabel:`Created`});return}n.expression===void 0&&(n.expression=await t(`expression`,`The filter expression.`)),n.mode===void 0&&(n.mode=await t(`mode`,`The filter's mode. Must be one of 'enabled', 'disabled', 'monitoring'.`));let c=l({expression:p(n.expression,`expression`,`text`),mode:p(n.mode,`mode`,`text`)});u(await f(`Creating`,async()=>r.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.filters.create({body:c,account_id:a})),{successLabel:`Created`})}};function tt(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 nt={command:`account`,describe:`Delete all TCP Flow Protection filters for an account.`,builder:tt,handler:async t=>{if(t.dryRun){d({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/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters`,pathParams:{},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
13
+ `);return}u(await f(`Deleting`,async()=>n.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.filters.delete.for.account({account_id:a})),{successLabel:`Deleted`})}},rt={command:`for`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(nt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function it(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 at={command:`filter <filter-id>`,describe:`Delete a TCP Flow Protection filter specified by the given UUID.`,builder:it,handler:async t=>{if(t.dryRun){d({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/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters/${t[`filter-id`]==null?`<filter-id>`:encodeURIComponent(String(t[`filter-id`]))}`,pathParams:{"filter-id":String(t[`filter-id`]??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
14
+ `);return}u(await f(`Deleting`,async()=>n.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.filters.delete.protection.filter({account_id:a,filter_id:t[`filter-id`]})),{successLabel:`Deleted`})}},ot={command:`protection`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(at).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},st={command:`delete`,describe:`Operations for advanced-tcp-protection.configs.tcp.flow.protection.filters.delete`,builder:e=>e.command(rt).command(ot).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ct(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 lt={command:`get <filter-id>`,describe:`Get a TCP Flow Protection filter specified by the given UUID.`,builder:ct,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection filters get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters/${t[`filter-id`]==null?`<filter-id>`:encodeURIComponent(String(t[`filter-id`]))}`,pathParams:{"filter-id":String(t[`filter-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,u(await f(`Loading`,async()=>n.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.filters.get({account_id:r,filter_id:t[`filter-id`]})),{successLabel:`Loaded`})}};function ut(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 dt={command:`list`,describe:`List all TCP Flow Protection filters for an account.`,builder:ut,handler:async t=>{let n={mode:t.mode,page:t.page,per_page:t[`per-page`],order:t.order,direction:t.direction};if(t.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection filters list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters`,pathParams:{},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?m:await i(r);t.accountId=a,u(await f(`Loading`,async()=>r.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.filters.list({account_id:a,...n})),{successLabel:`Loaded`})}};function ft(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 pt={command:`update <filter-id>`,describe:`Update a TCP Flow Protection filter specified by the given UUID.`,builder:ft,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection filters update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters/${t[`filter-id`]==null?`<filter-id>`:encodeURIComponent(String(t[`filter-id`]))}`,pathParams:{"filter-id":String(t[`filter-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({expression:p(t.expression,`expression`,`text`),mode:p(t.mode,`mode`,`text`)}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Updating`,async()=>n.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.filters.update({body:e,account_id:r,filter_id:t[`filter-id`]})),{successLabel:`Updated`});return}let a=l({expression:p(t.expression,`expression`,`text`),mode:p(t.mode,`mode`,`text`)});u(await f(`Updating`,async()=>n.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.filters.update({body:a,account_id:r,filter_id:t[`filter-id`]})),{successLabel:`Updated`})}},mt={command:`filters`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(et).command(lt).command(dt).command(pt).command(st).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ht(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 gt={command:`create`,describe:`Create a TCP Flow Protection rule for an account.`,builder:ht,handler:async n=>{if(n.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({burst_sensitivity:p(n[`burst-sensitivity`],`burst-sensitivity`,`text`),mode:p(n.mode,`mode`,`text`),name:p(n.name,`name`,`text`),rate_sensitivity:p(n[`rate-sensitivity`],`rate-sensitivity`,`text`),scope:p(n.scope,`scope`,`text`)}):s(n.body)});return}let r=await o(n),a=n.local?m:await i(r);if(n.accountId=a,n.body){let e=s(n.body);u(await f(`Creating`,async()=>r.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.rules.create({...e,account_id:a})),{successLabel:`Created`});return}n[`burst-sensitivity`]===void 0&&(n[`burst-sensitivity`]=await t(`burst-sensitivity`,`The burst sensitivity. Must be one of 'low', 'medium', 'high'.`)),n.mode===void 0&&(n.mode=await t(`mode`,`The mode for the TCP Flow Protection. Must be one of 'enabled', 'disabled', 'monitoring'.`)),n.name===void 0&&(n.name=await t(`name`,`The name of the TCP Flow Protection rule. Value is relative to the 'scope' setting. For 'global' scope, name should be 'global'. For either the 'region' or 'datacenter' scope, name should be the actual name of the region or datacenter, e.g., 'wnam' or 'lax'.`)),n[`rate-sensitivity`]===void 0&&(n[`rate-sensitivity`]=await t(`rate-sensitivity`,`The rate sensitivity. Must be one of 'low', 'medium', 'high'.`)),n.scope===void 0&&(n.scope=await t(`scope`,`The scope for the TCP Flow Protection rule.`));let c=l({burst_sensitivity:p(n[`burst-sensitivity`],`burst-sensitivity`,`text`),mode:p(n.mode,`mode`,`text`),name:p(n.name,`name`,`text`),rate_sensitivity:p(n[`rate-sensitivity`],`rate-sensitivity`,`text`),scope:p(n.scope,`scope`,`text`)});u(await f(`Creating`,async()=>r.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.rules.create({...c,account_id:a})),{successLabel:`Created`})}};function _t(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 vt={command:`account`,describe:`Delete all TCP Flow Protection rules for an account.`,builder:_t,handler:async t=>{if(t.dryRun){d({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/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules`,pathParams:{},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
15
+ `);return}u(await f(`Deleting`,async()=>n.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.rules.delete.for.account({account_id:a})),{successLabel:`Deleted`})}},yt={command:`for`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(vt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function bt(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 xt={command:`rule <rule-id>`,describe:`Delete a TCP Flow Protection rule specified by the given UUID.`,builder:bt,handler:async t=>{if(t.dryRun){d({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/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules/${t[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(t[`rule-id`]))}`,pathParams:{"rule-id":String(t[`rule-id`]??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
16
+ `);return}u(await f(`Deleting`,async()=>n.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.rules.delete.protection.rule({account_id:a,rule_id:t[`rule-id`]})),{successLabel:`Deleted`})}},St={command:`protection`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(xt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ct={command:`delete`,describe:`Operations for advanced-tcp-protection.configs.tcp.flow.protection.rules.delete`,builder:e=>e.command(yt).command(St).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function wt(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 Tt={command:`get <rule-id>`,describe:`Get a TCP Flow Protection rule specified by the given UUID.`,builder:wt,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules/${t[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(t[`rule-id`]))}`,pathParams:{"rule-id":String(t[`rule-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,u(await f(`Loading`,async()=>n.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.rules.get({account_id:r,rule_id:t[`rule-id`]})),{successLabel:`Loaded`})}};function Et(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 Dt={command:`list`,describe:`List all TCP Flow Protection rules for an account.`,builder:Et,handler:async t=>{let n={page:t.page,per_page:t[`per-page`],order:t.order,direction:t.direction};if(t.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules`,pathParams:{},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?m:await i(r);t.accountId=a,u(await f(`Loading`,async()=>r.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.rules.list({account_id:a,...n})),{successLabel:`Loaded`})}};function Ot(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 kt={command:`update <rule-id>`,describe:`Update a TCP Flow Protection rule specified by the given UUID.`,builder:Ot,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection rules update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules/${t[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(t[`rule-id`]))}`,pathParams:{"rule-id":String(t[`rule-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({burst_sensitivity:p(t[`burst-sensitivity`],`burst-sensitivity`,`text`),mode:p(t.mode,`mode`,`text`),rate_sensitivity:p(t[`rate-sensitivity`],`rate-sensitivity`,`text`)}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Updating`,async()=>n.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.rules.update({...e,account_id:r,rule_id:t[`rule-id`]})),{successLabel:`Updated`});return}let a=l({burst_sensitivity:p(t[`burst-sensitivity`],`burst-sensitivity`,`text`),mode:p(t.mode,`mode`,`text`),rate_sensitivity:p(t[`rate-sensitivity`],`rate-sensitivity`,`text`)});u(await f(`Updating`,async()=>n.magicTransit.advancedTcpProtection.configs.tcp.flow.protection.rules.update({...a,account_id:r,rule_id:t[`rule-id`]})),{successLabel:`Updated`})}},At={command:`rules`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(gt).command(Tt).command(Dt).command(kt).command(Ct).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},jt={command:`protection`,describe:`Operations for advanced-tcp-protection.configs.tcp.flow.protection`,builder:e=>e.command(mt).command(At).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Mt={command:`flow`,describe:`Operations for advanced-tcp-protection.configs.tcp.flow`,builder:e=>e.command(jt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Nt(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Pt={command:`get`,describe:`Get the protection status of the account.`,builder:Nt,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs tcp protection status get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_protection_status`,pathParams:{},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,u(await f(`Loading`,async()=>n.magicTransit.advancedTcpProtection.configs.tcp.protection.status.get({account_id:r})),{successLabel:`Loaded`})}};function Ft(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 It={command:`update`,describe:`Update the protection status of the account.`,builder:Ft,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit advanced-tcp-protection configs tcp protection status update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_protection_status`,pathParams:{},bodyKind:`json`,body:t.body===void 0?l({enabled:t.enabled}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Updating`,async()=>n.magicTransit.advancedTcpProtection.configs.tcp.protection.status.update({...e,account_id:r})),{successLabel:`Updated`});return}if(t.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);let a=l({enabled:t.enabled});u(await f(`Updating`,async()=>n.magicTransit.advancedTcpProtection.configs.tcp.protection.status.update({...a,account_id:r})),{successLabel:`Updated`})}},Lt={command:`status`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(Pt).command(It).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Rt={command:`protection`,describe:`Operations for advanced-tcp-protection.configs.tcp.protection`,builder:e=>e.command(Lt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},zt={command:`tcp`,describe:`Operations for advanced-tcp-protection.configs.tcp`,builder:e=>e.command(Mt).command(Rt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Bt={command:`configs`,describe:`Operations for advanced-tcp-protection.configs`,builder:e=>e.command(Z).command(ve).command(Qe).command(zt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Vt={command:`advanced-tcp-protection`,describe:`Operations for advanced-tcp-protection`,builder:e=>e.command(Bt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ht(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 Ut={command:`create`,describe:`Creates a new App for an account`,builder:Ht,handler:async n=>{if(n.dryRun){d({command:`cf magic-transit apps create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/apps`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({hostnames:n.hostnames,name:p(n.name,`name`,`text`),type:p(n.type,`type`,`text`)}):s(n.body)});return}let r=await o(n),a=n.local?m:await i(r);if(n.accountId=a,n.body){let e=s(n.body);u(await f(`Creating`,async()=>r.magicTransit.apps.create({body:e,account_id:a})),{successLabel:`Created`});return}n.name===void 0&&(n.name=await t(`name`,`Display name for the app.`)),n.type===void 0&&(n.type=await t(`type`,`Category of the app.`));let c=l({hostnames:n.hostnames,name:p(n.name,`name`,`text`),type:p(n.type,`type`,`text`)});u(await f(`Creating`,async()=>r.magicTransit.apps.create({body:c,account_id:a})),{successLabel:`Created`})}};function Wt(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 Gt={command:`delete <account-app-id>`,describe:`Deletes specific Account App.`,builder:Wt,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit apps delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/apps/${t[`account-app-id`]==null?`<account-app-id>`:encodeURIComponent(String(t[`account-app-id`]))}`,pathParams:{"account-app-id":String(t[`account-app-id`]??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
17
+ `);return}u(await f(`Deleting`,async()=>n.magicTransit.apps.delete({account_id:a,account_app_id:t[`account-app-id`]})),{successLabel:`Deleted`})}};function Kt(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 qt={command:`edit <account-app-id>`,describe:`Updates an Account App`,builder:Kt,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit apps edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/apps/${t[`account-app-id`]==null?`<account-app-id>`:encodeURIComponent(String(t[`account-app-id`]))}`,pathParams:{"account-app-id":String(t[`account-app-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({hostnames:t.hostnames,name:p(t.name,`name`,`text`),type:p(t.type,`type`,`text`)}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Updating`,async()=>n.magicTransit.apps.edit({body:e,account_id:r,account_app_id:t[`account-app-id`]})),{successLabel:`Updated`});return}let a=l({hostnames:t.hostnames,name:p(t.name,`name`,`text`),type:p(t.type,`type`,`text`)});u(await f(`Updating`,async()=>n.magicTransit.apps.edit({body:a,account_id:r,account_app_id:t[`account-app-id`]})),{successLabel:`Updated`})}};function Jt(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Yt={command:`list`,describe:`Lists Apps associated with an account.`,builder:Jt,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit apps list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/apps`,pathParams:{},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,u(await f(`Loading`,async()=>n.magicTransit.apps.list({account_id:r})),{successLabel:`Loaded`})}};function Xt(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 Zt={command:`update <account-app-id>`,describe:`Updates an Account App`,builder:Xt,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit apps update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/apps/${t[`account-app-id`]==null?`<account-app-id>`:encodeURIComponent(String(t[`account-app-id`]))}`,pathParams:{"account-app-id":String(t[`account-app-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({hostnames:t.hostnames,name:p(t.name,`name`,`text`),type:p(t.type,`type`,`text`)}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Updating`,async()=>n.magicTransit.apps.update({body:e,account_id:r,account_app_id:t[`account-app-id`]})),{successLabel:`Updated`});return}let a=l({hostnames:t.hostnames,name:p(t.name,`name`,`text`),type:p(t.type,`type`,`text`)});u(await f(`Updating`,async()=>n.magicTransit.apps.update({body:a,account_id:r,account_app_id:t[`account-app-id`]})),{successLabel:`Updated`})}},Qt={command:`apps`,describe:`Operations for apps`,builder:e=>e.command(Ut).command(Gt).command(qt).command(Yt).command(Zt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function $t(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 en={command:`create`,describe:`Creates a new BGP filter profile for an account.`,builder:$t,handler:async r=>{if(r.dryRun){d({command:`cf magic-transit bgp-filter-profiles create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/bgp/filter_profiles`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({description:p(r.description,`description`,`text`),match_action:p(r[`match-action`],`match-action`,`text`),name:p(r.name,`name`,`text`),targets:r.targets}):s(r.body)});return}let a=await o(r),c=r.local?m:await i(a);if(r.accountId=c,r.body){let e=s(r.body);u(await f(`Creating`,async()=>a.magicTransit.bgpFilterProfiles.create({...e,account_id:c})),{successLabel:`Created`});return}if(r[`match-action`]===void 0&&(r[`match-action`]=await n(`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 t(`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=l({description:p(r.description,`description`,`text`),match_action:p(r[`match-action`],`match-action`,`text`),name:p(r.name,`name`,`text`),targets:r.targets});u(await f(`Creating`,async()=>a.magicTransit.bgpFilterProfiles.create({...h,account_id:c})),{successLabel:`Created`})}};function tn(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 nn={command:`delete <profile-id>`,describe:`Deletes a BGP filter profile.`,builder:tn,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit bgp-filter-profiles delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/bgp/filter_profiles/${t[`profile-id`]==null?`<profile-id>`:encodeURIComponent(String(t[`profile-id`]))}`,pathParams:{"profile-id":String(t[`profile-id`]??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
18
+ `);return}u(await f(`Deleting`,async()=>n.magicTransit.bgpFilterProfiles.delete({account_id:a,profile_id:t[`profile-id`]})),{successLabel:`Deleted`})}};function rn(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 an={command:`get <profile-id>`,describe:`Gets a specific BGP filter profile for an account.`,builder:rn,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit bgp-filter-profiles get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/bgp/filter_profiles/${t[`profile-id`]==null?`<profile-id>`:encodeURIComponent(String(t[`profile-id`]))}`,pathParams:{"profile-id":String(t[`profile-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,u(await f(`Loading`,async()=>n.magicTransit.bgpFilterProfiles.get({account_id:r,profile_id:t[`profile-id`]})),{successLabel:`Loaded`})}};function on(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const sn={command:`list`,describe:`Lists all BGP filter profiles for an account.`,builder:on,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit bgp-filter-profiles list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/bgp/filter_profiles`,pathParams:{},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,u(await f(`Loading`,async()=>n.magicTransit.bgpFilterProfiles.list({account_id:r})),{successLabel:`Loaded`})}};function cn(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 ln={command:`update <profile-id>`,describe:'Updates a BGP filter profile. Omitted properties are left unchanged. To clear an existing description send `description: ""`.',builder:cn,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit bgp-filter-profiles update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/bgp/filter_profiles/${t[`profile-id`]==null?`<profile-id>`:encodeURIComponent(String(t[`profile-id`]))}`,pathParams:{"profile-id":String(t[`profile-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({description:p(t.description,`description`,`text`),match_action:p(t[`match-action`],`match-action`,`text`),name:p(t.name,`name`,`text`),targets:t.targets}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Updating`,async()=>n.magicTransit.bgpFilterProfiles.update({...e,account_id:r,profile_id:t[`profile-id`]})),{successLabel:`Updated`});return}let a=l({description:p(t.description,`description`,`text`),match_action:p(t[`match-action`],`match-action`,`text`),name:p(t.name,`name`,`text`),targets:t.targets});u(await f(`Updating`,async()=>n.magicTransit.bgpFilterProfiles.update({...a,account_id:r,profile_id:t[`profile-id`]})),{successLabel:`Updated`})}},un={command:`bgp-filter-profiles`,describe:`Operations for bgp-filter-profiles`,builder:e=>e.command(en).command(nn).command(an).command(sn).command(ln).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function dn(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const fn={command:`get`,describe:`Gets the BGP settings for an account, including the default ASN and redistribution configuration.`,builder:dn,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit bgp-settings get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/bgp/settings`,pathParams:{},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,u(await f(`Loading`,async()=>n.magicTransit.bgpSettings.get({account_id:r})),{successLabel:`Loaded`})}};function pn(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 mn={command:`update`,describe:`Modifies the BGP settings for an account, including the default ASN and redistribution configuration.`,builder:pn,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit bgp-settings update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/bgp/settings`,pathParams:{},bodyKind:`json`,body:t.body===void 0?l({cloudflare_asn:t[`cloudflare-asn`],redistribute:{"static:wan":t[`redistribute-static:wan`]}}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Updating`,async()=>n.magicTransit.bgpSettings.update({...e,account_id:r})),{successLabel:`Updated`});return}let a=l({cloudflare_asn:t[`cloudflare-asn`],redistribute:{"static:wan":t[`redistribute-static:wan`]}});u(await f(`Updating`,async()=>n.magicTransit.bgpSettings.update({...a,account_id:r})),{successLabel:`Updated`})}},hn={command:`bgp-settings`,describe:`Operations for bgp-settings`,builder:e=>e.command(fn).command(mn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function gn(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:"Updates multiple interconnects associated with an account. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes.",builder:gn,handler:async t=>{let n={};if(t[`x-magic-new-hc-target`]!==void 0&&(n[`x-magic-new-hc-target`]=String(t[`x-magic-new-hc-target`])),t.dryRun){d({command:`cf magic-transit cf-interconnects bulk-update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cf_interconnects`,pathParams:{},bodyKind:`json`,body:t.body===void 0?void 0:s(t.body)});return}let r=await o(t),c=t.local?m:await i(r);if(t.accountId=c,t.body){let e=s(t.body);u(await f(`Updating`,async()=>a(r,`PUT`,`/accounts/${c}/magic/cf_interconnects`,{body:e,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated`});return}u(await f(`Updating`,async()=>a(r,`PUT`,`/accounts/${c}/magic/cf_interconnects`,{headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated`})}};function vn(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 yn={command:`get <cf-interconnect-id>`,describe:`Lists details for a specific interconnect.`,builder:vn,handler:async t=>{let n={};if(t[`x-magic-new-hc-target`]!==void 0&&(n[`x-magic-new-hc-target`]=String(t[`x-magic-new-hc-target`])),t.dryRun){d({command:`cf magic-transit cf-interconnects get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cf_interconnects/${t[`cf-interconnect-id`]==null?`<cf-interconnect-id>`:encodeURIComponent(String(t[`cf-interconnect-id`]))}`,pathParams:{"cf-interconnect-id":String(t[`cf-interconnect-id`]??``)},bodyKind:`none`});return}let r=await o(t),s=t.local?m:await i(r);t.accountId=s,u(await f(`Loading`,async()=>a(r,`GET`,`/accounts/${s}/magic/cf_interconnects/${encodeURIComponent(String(t[`cf-interconnect-id`]))}`,{headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Loaded`})}};function bn(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 xn={command:`list`,describe:`Lists interconnects associated with an account.`,builder:bn,handler:async t=>{let n={};if(t[`x-magic-new-hc-target`]!==void 0&&(n[`x-magic-new-hc-target`]=String(t[`x-magic-new-hc-target`])),t.dryRun){d({command:`cf magic-transit cf-interconnects list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cf_interconnects`,pathParams:{},bodyKind:`none`});return}let r=await o(t),s=t.local?m:await i(r);t.accountId=s,u(await f(`Loading`,async()=>a(r,`GET`,`/accounts/${s}/magic/cf_interconnects`,{headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Loaded`})}};function Sn(e){return e.positional(`cf-interconnect-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the request and response bodies will be presented using the new object format. Defaults to false.`}).option(`automatic-return-routing`,{type:`boolean`,description:"True if automatic stateful return routing should be enabled for a tunnel, false otherwise. Requires the `coupler_integration` account flag to be enabled; requests setting this to `true` without that flag will be rejected."}).option(`description`,{type:`string`,description:`An optional description of the interconnect.`}).option(`gre-cloudflare-endpoint`,{type:`string`,description:`The IP address assigned to the Cloudflare side of the GRE tunnel created as part of the Interconnect.`}).option(`health-check-enabled`,{type:`boolean`,description:`Determines whether to run healthchecks for a tunnel.`}).option(`health-check-rate`,{type:`string`,description:"How frequent the health check is run. The default value is `mid`.",choices:[`low`,`mid`,`high`]}).option(`health-check-target-saved`,{type:`string`,description:`The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used.`}).option(`health-check-type`,{type:`string`,description:"The type of healthcheck to run, reply or request. The default value is `reply`.",choices:[`reply`,`request`]}).option(`interface-address`,{type:`string`,description:`A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255.`}).option(`interface-address6`,{type:`string`,description:`A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127`}).option(`mtu`,{type:`number`,description:`The Maximum Transmission Unit (MTU) in bytes for the interconnect. The minimum value is 576.`}).option(`name`,{type:`string`,description:`The name of the interconnect. The name cannot share a name with other tunnels.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Cn={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:Sn,handler:async t=>{let n={};if(t[`x-magic-new-hc-target`]!==void 0&&(n[`x-magic-new-hc-target`]=String(t[`x-magic-new-hc-target`])),t.dryRun){d({command:`cf magic-transit cf-interconnects update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cf_interconnects/${t[`cf-interconnect-id`]==null?`<cf-interconnect-id>`:encodeURIComponent(String(t[`cf-interconnect-id`]))}`,pathParams:{"cf-interconnect-id":String(t[`cf-interconnect-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({automatic_return_routing:t[`automatic-return-routing`],description:p(t.description,`description`,`text`),gre:{cloudflare_endpoint:p(t[`gre-cloudflare-endpoint`],`gre-cloudflare-endpoint`,`text`)},health_check:{enabled:t[`health-check-enabled`],rate:p(t[`health-check-rate`],`health-check-rate`,`text`),target:{saved:p(t[`health-check-target-saved`],`health-check-target-saved`,`text`)},type:p(t[`health-check-type`],`health-check-type`,`text`)},interface_address:p(t[`interface-address`],`interface-address`,`text`),interface_address6:p(t[`interface-address6`],`interface-address6`,`text`),mtu:t.mtu,name:p(t.name,`name`,`text`)}):s(t.body)});return}let r=await o(t),h=t.local?m:await i(r);if(t.accountId=h,t.body){let e=s(t.body);u(await f(`Updating`,async()=>a(r,`PUT`,`/accounts/${h}/magic/cf_interconnects/${encodeURIComponent(String(t[`cf-interconnect-id`]))}`,{body:e,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated`});return}let g={};t[`automatic-return-routing`]!==void 0&&c(g,[`automatic_return_routing`],t[`automatic-return-routing`]),t.description!==void 0&&c(g,[`description`],p(t.description,`description`,`text`)),t[`gre-cloudflare-endpoint`]!==void 0&&c(g,[`gre`,`cloudflare_endpoint`],p(t[`gre-cloudflare-endpoint`],`gre-cloudflare-endpoint`,`text`)),t[`health-check-enabled`]!==void 0&&c(g,[`health_check`,`enabled`],t[`health-check-enabled`]),t[`health-check-rate`]!==void 0&&c(g,[`health_check`,`rate`],p(t[`health-check-rate`],`health-check-rate`,`text`)),t[`health-check-target-saved`]!==void 0&&c(g,[`health_check`,`target`,`saved`],p(t[`health-check-target-saved`],`health-check-target-saved`,`text`)),t[`health-check-type`]!==void 0&&c(g,[`health_check`,`type`],p(t[`health-check-type`],`health-check-type`,`text`)),t[`interface-address`]!==void 0&&c(g,[`interface_address`],p(t[`interface-address`],`interface-address`,`text`)),t[`interface-address6`]!==void 0&&c(g,[`interface_address6`],p(t[`interface-address6`],`interface-address6`,`text`)),t.mtu!==void 0&&c(g,[`mtu`],t.mtu),t.name!==void 0&&c(g,[`name`],p(t.name,`name`,`text`)),u(await f(`Updating`,async()=>a(r,`PUT`,`/accounts/${h}/magic/cf_interconnects/${encodeURIComponent(String(t[`cf-interconnect-id`]))}`,{body:Object.keys(g).length>0?g:void 0,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated`})}},wn={command:`cf-interconnects`,describe:`Operations for cf-interconnects`,builder:e=>e.command(_n).command(yn).command(xn).command(Cn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Tn(e){return e.option(`device-id`,{type:`string`,description:`The device.id field`}).option(`device-provision-license`,{type:`boolean`,description:`When true, create and provision a new licence key for the connector.`}).option(`device-serial-number`,{type:`string`,description:`The device.serial_number field`}).option(`activated`,{type:`boolean`,description:`The activated field`}).option(`interrupt-window-days-of-week`,{type:`string`,array:!0,description:`Allowed days of the week for upgrades. Default is all days.`}).option(`interrupt-window-duration-hours`,{type:`number`,description:`The interrupt_window_duration_hours field`}).option(`interrupt-window-embargo-dates`,{type:`string`,array:!0,description:`List of dates (YYYY-MM-DD) when upgrades are blocked.`}).option(`interrupt-window-hour-of-day`,{type:`number`,description:`The interrupt_window_hour_of_day field`}).option(`notes`,{type:`string`,description:`The notes field`}).option(`primary`,{type:`boolean`,description:`The primary field`,default:!0}).option(`site-id`,{type:`string`,description:`The site_id field`}).option(`timezone`,{type:`string`,description:`The timezone field`}).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 En={command:`create`,describe:`Creates a Magic WAN Connector.`,builder:Tn,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit connectors create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/connectors`,pathParams:{},bodyKind:`json`,body:t.body===void 0?l({device:{id:p(t[`device-id`],`device-id`,`text`),provision_license:t[`device-provision-license`],serial_number:p(t[`device-serial-number`],`device-serial-number`,`text`)},activated:t.activated,interrupt_window_days_of_week:t[`interrupt-window-days-of-week`],interrupt_window_duration_hours:t[`interrupt-window-duration-hours`],interrupt_window_embargo_dates:t[`interrupt-window-embargo-dates`],interrupt_window_hour_of_day:t[`interrupt-window-hour-of-day`],notes:p(t.notes,`notes`,`text`),primary:t.primary,site_id:p(t[`site-id`],`site-id`,`text`),timezone:p(t.timezone,`timezone`,`text`)}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Creating`,async()=>n.magicTransit.connectors.create({...e,account_id:r})),{successLabel:`Created`});return}let a=l({device:{id:p(t[`device-id`],`device-id`,`text`),provision_license:t[`device-provision-license`],serial_number:p(t[`device-serial-number`],`device-serial-number`,`text`)},activated:t.activated,interrupt_window_days_of_week:t[`interrupt-window-days-of-week`],interrupt_window_duration_hours:t[`interrupt-window-duration-hours`],interrupt_window_embargo_dates:t[`interrupt-window-embargo-dates`],interrupt_window_hour_of_day:t[`interrupt-window-hour-of-day`],notes:p(t.notes,`notes`,`text`),primary:t.primary,site_id:p(t[`site-id`],`site-id`,`text`),timezone:p(t.timezone,`timezone`,`text`)});u(await f(`Creating`,async()=>n.magicTransit.connectors.create({...a,account_id:r})),{successLabel:`Created`})}};function Dn(e){return e.positional(`connector-id`,{type:`string`,description:`Connector ID`,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 $={command:`delete <connector-id>`,describe:`Deletes a Magic WAN Connector.`,builder:Dn,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit connectors delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/connectors/${t[`connector-id`]==null?`<connector-id>`:encodeURIComponent(String(t[`connector-id`]))}`,pathParams:{"connector-id":String(t[`connector-id`]??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
19
+ `);return}u(await f(`Deleting`,async()=>n.magicTransit.connectors.delete({account_id:a,connector_id:t[`connector-id`]})),{successLabel:`Deleted`})}};function On(e){return e.positional(`connector-id`,{type:`string`,description:`Connector ID`,demandOption:!0}).option(`activated`,{type:`boolean`,description:`The activated field`}).option(`interrupt-window-days-of-week`,{type:`string`,array:!0,description:`Allowed days of the week for upgrades. Default is all days.`}).option(`interrupt-window-duration-hours`,{type:`number`,description:`The interrupt_window_duration_hours field`}).option(`interrupt-window-embargo-dates`,{type:`string`,array:!0,description:`List of dates (YYYY-MM-DD) when upgrades are blocked.`}).option(`interrupt-window-hour-of-day`,{type:`number`,description:`The interrupt_window_hour_of_day field`}).option(`notes`,{type:`string`,description:`The notes field`}).option(`primary`,{type:`boolean`,description:`The primary field`}).option(`site-id`,{type:`string`,description:`The site_id field`}).option(`timezone`,{type:`string`,description:`The timezone field`}).option(`provision-license`,{type:`boolean`,description:`When true, regenerate license key for the connector.`}).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:`edit <connector-id>`,describe:`Updates properties of a Magic WAN Connector. May be used to re-provision a license key.`,builder:On,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit connectors edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/connectors/${t[`connector-id`]==null?`<connector-id>`:encodeURIComponent(String(t[`connector-id`]))}`,pathParams:{"connector-id":String(t[`connector-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({activated:t.activated,interrupt_window_days_of_week:t[`interrupt-window-days-of-week`],interrupt_window_duration_hours:t[`interrupt-window-duration-hours`],interrupt_window_embargo_dates:t[`interrupt-window-embargo-dates`],interrupt_window_hour_of_day:t[`interrupt-window-hour-of-day`],notes:p(t.notes,`notes`,`text`),primary:t.primary,site_id:p(t[`site-id`],`site-id`,`text`),timezone:p(t.timezone,`timezone`,`text`),provision_license:t[`provision-license`]}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Updating`,async()=>n.magicTransit.connectors.edit({body:e,account_id:r,connector_id:t[`connector-id`]})),{successLabel:`Updated`});return}let a=l({activated:t.activated,interrupt_window_days_of_week:t[`interrupt-window-days-of-week`],interrupt_window_duration_hours:t[`interrupt-window-duration-hours`],interrupt_window_embargo_dates:t[`interrupt-window-embargo-dates`],interrupt_window_hour_of_day:t[`interrupt-window-hour-of-day`],notes:p(t.notes,`notes`,`text`),primary:t.primary,site_id:p(t[`site-id`],`site-id`,`text`),timezone:p(t.timezone,`timezone`,`text`),provision_license:t[`provision-license`]});u(await f(`Updating`,async()=>n.magicTransit.connectors.edit({body:a,account_id:r,connector_id:t[`connector-id`]})),{successLabel:`Updated`})}};function An(e){return e.option(`connector-id`,{type:`string`,description:`Connector ID`,demandOption:!0}).option(`from`,{type:`number`,description:`From`,demandOption:!0}).option(`to`,{type:`number`,description:`To`,demandOption:!0}).option(`limit`,{type:`number`,description:`Limit`}).option(`cursor`,{type:`string`,description:`Cursor`}).option(`k`,{type:`string`,description:`Filter by event kind`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const jn={command:`list`,describe:`Lists Magic WAN Connector Telemetry Events`,builder:An,handler:async t=>{let n={from:t.from,to:t.to,limit:t.limit,cursor:t.cursor,k:t.k};if(t.dryRun){d({command:`cf magic-transit connectors events list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/connectors/${t[`connector-id`]==null?`<connector-id>`:encodeURIComponent(String(t[`connector-id`]))}/telemetry/events`,pathParams:{"connector-id":String(t[`connector-id`]??``)},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?m:await i(r);t.accountId=a,u(await f(`Loading`,async()=>r.magicTransit.connectors.events.list({account_id:a,connector_id:t[`connector-id`],...n})),{successLabel:`Loaded`})}},Mn={command:`events`,describe:`Magic WAN Connector appliances — provisioning, telemetry events, and configuration snapshots`,builder:e=>e.command(jn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Nn(e){return e.positional(`connector-id`,{type:`string`,description:`Connector ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Pn={command:`get <connector-id>`,describe:`Fetches a Magic WAN Connector.`,builder:Nn,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit connectors get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/connectors/${t[`connector-id`]==null?`<connector-id>`:encodeURIComponent(String(t[`connector-id`]))}`,pathParams:{"connector-id":String(t[`connector-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,u(await f(`Loading`,async()=>n.magicTransit.connectors.get({account_id:r,connector_id:t[`connector-id`]})),{successLabel:`Loaded`})}};function Fn(e){return e.option(`device-type`,{type:`string`,description:`Filter connectors by device type.`,choices:[`MANAGED`,`LICENSED`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const In={command:`list`,describe:`Lists Magic WAN Connectors.`,builder:h(Fn),handler:async t=>{let n={device_type:t[`device-type`]};if(t.dryRun){d({command:`cf magic-transit connectors list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/connectors`,pathParams:{},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?m:await i(r);t.accountId=a,u(await f(`Loading`,async()=>r.magicTransit.connectors.list({account_id:a,...n})),{successLabel:`Loaded`})}};function Ln(e){return e.option(`connector-id`,{type:`string`,description:`Connector ID`,demandOption:!0}).option(`from`,{type:`number`,description:`From`,demandOption:!0}).option(`to`,{type:`number`,description:`To`,demandOption:!0}).option(`limit`,{type:`number`,description:`Limit`}).option(`cursor`,{type:`string`,description:`Cursor`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Rn={command:`list`,describe:`Lists Magic WAN Connector Telemetry Snapshots`,builder:Ln,handler:async t=>{let n={from:t.from,to:t.to,limit:t.limit,cursor:t.cursor};if(t.dryRun){d({command:`cf magic-transit connectors snapshots list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/connectors/${t[`connector-id`]==null?`<connector-id>`:encodeURIComponent(String(t[`connector-id`]))}/telemetry/snapshots`,pathParams:{"connector-id":String(t[`connector-id`]??``)},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?m:await i(r);t.accountId=a,u(await f(`Loading`,async()=>r.magicTransit.connectors.snapshots.list({account_id:a,connector_id:t[`connector-id`],...n})),{successLabel:`Loaded`})}},zn={command:`snapshots`,describe:`Magic WAN Connector appliances — provisioning, telemetry events, and configuration snapshots`,builder:e=>e.command(Rn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Bn(e){return e.positional(`connector-id`,{type:`string`,description:`Connector ID`,demandOption:!0}).option(`activated`,{type:`boolean`,description:`The activated field`}).option(`interrupt-window-days-of-week`,{type:`string`,array:!0,description:`Allowed days of the week for upgrades. Default is all days.`}).option(`interrupt-window-duration-hours`,{type:`number`,description:`The interrupt_window_duration_hours field`}).option(`interrupt-window-embargo-dates`,{type:`string`,array:!0,description:`List of dates (YYYY-MM-DD) when upgrades are blocked.`}).option(`interrupt-window-hour-of-day`,{type:`number`,description:`The interrupt_window_hour_of_day field`}).option(`notes`,{type:`string`,description:`The notes field`}).option(`primary`,{type:`boolean`,description:`The primary field`}).option(`site-id`,{type:`string`,description:`The site_id field`}).option(`timezone`,{type:`string`,description:`The timezone field`}).option(`provision-license`,{type:`boolean`,description:`When true, regenerate license key for the connector.`}).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 <connector-id>`,describe:`Replaces properties of a Magic WAN Connector. May be used to re-provision a license key.`,builder:Bn,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit connectors update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/connectors/${t[`connector-id`]==null?`<connector-id>`:encodeURIComponent(String(t[`connector-id`]))}`,pathParams:{"connector-id":String(t[`connector-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({activated:t.activated,interrupt_window_days_of_week:t[`interrupt-window-days-of-week`],interrupt_window_duration_hours:t[`interrupt-window-duration-hours`],interrupt_window_embargo_dates:t[`interrupt-window-embargo-dates`],interrupt_window_hour_of_day:t[`interrupt-window-hour-of-day`],notes:p(t.notes,`notes`,`text`),primary:t.primary,site_id:p(t[`site-id`],`site-id`,`text`),timezone:p(t.timezone,`timezone`,`text`),provision_license:t[`provision-license`]}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Updating`,async()=>n.magicTransit.connectors.update({body:e,account_id:r,connector_id:t[`connector-id`]})),{successLabel:`Updated`});return}let a=l({activated:t.activated,interrupt_window_days_of_week:t[`interrupt-window-days-of-week`],interrupt_window_duration_hours:t[`interrupt-window-duration-hours`],interrupt_window_embargo_dates:t[`interrupt-window-embargo-dates`],interrupt_window_hour_of_day:t[`interrupt-window-hour-of-day`],notes:p(t.notes,`notes`,`text`),primary:t.primary,site_id:p(t[`site-id`],`site-id`,`text`),timezone:p(t.timezone,`timezone`,`text`),provision_license:t[`provision-license`]});u(await f(`Updating`,async()=>n.magicTransit.connectors.update({body:a,account_id:r,connector_id:t[`connector-id`]})),{successLabel:`Updated`})}},Hn={command:`connectors`,describe:`Magic WAN Connector appliances — provisioning, telemetry events, and configuration snapshots`,builder:e=>e.command(En).command($).command(kn).command(Pn).command(In).command(Vn).command(Mn).command(zn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Un(e){return e.option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the request and response bodies will be presented using the new object format. Defaults to false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Wn={command:`bulk-update`,describe:"Updates multiple GRE tunnels. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes.",builder:Un,handler:async t=>{let n={};if(t[`x-magic-new-hc-target`]!==void 0&&(n[`x-magic-new-hc-target`]=String(t[`x-magic-new-hc-target`])),t.dryRun){d({command:`cf magic-transit gre-tunnels bulk-update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/gre_tunnels`,pathParams:{},bodyKind:`json`,body:t.body===void 0?void 0:s(t.body)});return}let r=await o(t),c=t.local?m:await i(r);if(t.accountId=c,t.body){let e=s(t.body);u(await f(`Updating`,async()=>a(r,`PUT`,`/accounts/${c}/magic/gre_tunnels`,{body:e,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated`});return}u(await f(`Updating`,async()=>a(r,`PUT`,`/accounts/${c}/magic/gre_tunnels`,{headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated`})}};function Gn(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.
20
+
21
+ Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the
22
+ key is not treated as a secret value. This is *only* supported for preventing
23
+ misconfiguration, not for defending against malicious attacks.
24
+
25
+ The MD5 key, if set, must be of non-zero length and consist only of the following types of
26
+ character:
27
+
28
+ * ASCII alphanumerics: \`[a-zA-Z0-9]\`
29
+ * Special characters in the set \`'!@#$%^&*()+[]{}<>/.,;:_-~\`= \\|\`
30
+
31
+ In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A),
32
+ quotation mark (\`"\`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed
33
+ (0x0C), and the question mark (\`?\`). Requests specifying an MD5 key with one or more of
34
+ 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 Kn={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:Gn,handler:async n=>{let r={};if(n[`x-magic-new-hc-target`]!==void 0&&(r[`x-magic-new-hc-target`]=String(n[`x-magic-new-hc-target`])),n.dryRun){d({command:`cf magic-transit gre-tunnels create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/gre_tunnels`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({automatic_return_routing:n[`automatic-return-routing`],bgp:{customer_asn:n[`bgp-customer-asn`],export_filter_id:p(n[`bgp-export-filter-id`],`bgp-export-filter-id`,`text`),extra_prefixes:n[`bgp-extra-prefixes`],import_filter_id:p(n[`bgp-import-filter-id`],`bgp-import-filter-id`,`text`),md5_key:p(n[`bgp-md5-key`],`bgp-md5-key`,`text`)},cloudflare_gre_endpoint:p(n[`cloudflare-gre-endpoint`],`cloudflare-gre-endpoint`,`text`),customer_gre_endpoint:p(n[`customer-gre-endpoint`],`customer-gre-endpoint`,`text`),description:p(n.description,`description`,`text`),health_check:{enabled:n[`health-check-enabled`],rate:p(n[`health-check-rate`],`health-check-rate`,`text`),target:{saved:p(n[`health-check-target-saved`],`health-check-target-saved`,`text`)},type:p(n[`health-check-type`],`health-check-type`,`text`),direction:p(n[`health-check-direction`],`health-check-direction`,`text`)},interface_address:p(n[`interface-address`],`interface-address`,`text`),interface_address6:p(n[`interface-address6`],`interface-address6`,`text`),mtu:n.mtu,name:p(n.name,`name`,`text`),ttl:n.ttl}):s(n.body)});return}let h=await o(n),g=n.local?m:await i(h);if(n.accountId=g,n.body){let e=s(n.body);u(await f(`Creating`,async()=>a(h,`POST`,`/accounts/${g}/magic/gre_tunnels`,{body:e,headers:Object.keys(r).length>0?r:void 0})),{successLabel:`Created`});return}n[`cloudflare-gre-endpoint`]===void 0&&(n[`cloudflare-gre-endpoint`]=await t(`cloudflare-gre-endpoint`,`The IP address assigned to the Cloudflare side of the GRE tunnel.`)),n[`customer-gre-endpoint`]===void 0&&(n[`customer-gre-endpoint`]=await t(`customer-gre-endpoint`,`The IP address assigned to the customer side of the GRE tunnel.`)),n[`interface-address`]===void 0&&(n[`interface-address`]=await t(`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.`)),n.name===void 0&&(n.name=await t(`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 _={};n[`automatic-return-routing`]!==void 0&&c(_,[`automatic_return_routing`],n[`automatic-return-routing`]),n[`bgp-customer-asn`]!==void 0&&c(_,[`bgp`,`customer_asn`],n[`bgp-customer-asn`]),n[`bgp-export-filter-id`]!==void 0&&c(_,[`bgp`,`export_filter_id`],p(n[`bgp-export-filter-id`],`bgp-export-filter-id`,`text`)),n[`bgp-extra-prefixes`]!==void 0&&c(_,[`bgp`,`extra_prefixes`],n[`bgp-extra-prefixes`]),n[`bgp-import-filter-id`]!==void 0&&c(_,[`bgp`,`import_filter_id`],p(n[`bgp-import-filter-id`],`bgp-import-filter-id`,`text`)),n[`bgp-md5-key`]!==void 0&&c(_,[`bgp`,`md5_key`],p(n[`bgp-md5-key`],`bgp-md5-key`,`text`)),n[`cloudflare-gre-endpoint`]!==void 0&&c(_,[`cloudflare_gre_endpoint`],p(n[`cloudflare-gre-endpoint`],`cloudflare-gre-endpoint`,`text`)),n[`customer-gre-endpoint`]!==void 0&&c(_,[`customer_gre_endpoint`],p(n[`customer-gre-endpoint`],`customer-gre-endpoint`,`text`)),n.description!==void 0&&c(_,[`description`],p(n.description,`description`,`text`)),n[`health-check-enabled`]!==void 0&&c(_,[`health_check`,`enabled`],n[`health-check-enabled`]),n[`health-check-rate`]!==void 0&&c(_,[`health_check`,`rate`],p(n[`health-check-rate`],`health-check-rate`,`text`)),n[`health-check-target-saved`]!==void 0&&c(_,[`health_check`,`target`,`saved`],p(n[`health-check-target-saved`],`health-check-target-saved`,`text`)),n[`health-check-type`]!==void 0&&c(_,[`health_check`,`type`],p(n[`health-check-type`],`health-check-type`,`text`)),n[`health-check-direction`]!==void 0&&c(_,[`health_check`,`direction`],p(n[`health-check-direction`],`health-check-direction`,`text`)),n[`interface-address`]!==void 0&&c(_,[`interface_address`],p(n[`interface-address`],`interface-address`,`text`)),n[`interface-address6`]!==void 0&&c(_,[`interface_address6`],p(n[`interface-address6`],`interface-address6`,`text`)),n.mtu!==void 0&&c(_,[`mtu`],n.mtu),n.name!==void 0&&c(_,[`name`],p(n.name,`name`,`text`)),n.ttl!==void 0&&c(_,[`ttl`],n.ttl),u(await f(`Creating`,async()=>a(h,`POST`,`/accounts/${g}/magic/gre_tunnels`,{body:Object.keys(_).length>0?_:void 0,headers:Object.keys(r).length>0?r:void 0})),{successLabel:`Created`})}};function qn(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 Jn={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:qn,handler:async t=>{let n={};if(t[`x-magic-new-hc-target`]!==void 0&&(n[`x-magic-new-hc-target`]=String(t[`x-magic-new-hc-target`])),t.dryRun){d({command:`cf magic-transit gre-tunnels delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/gre_tunnels/${t[`gre-tunnel-id`]==null?`<gre-tunnel-id>`:encodeURIComponent(String(t[`gre-tunnel-id`]))}`,pathParams:{"gre-tunnel-id":String(t[`gre-tunnel-id`]??``)},bodyKind:`none`});return}let s=await o(t),c=t.local?m:await i(s);if(t.accountId=c,!await r({force:!!t.force})){process.stderr.write(`Aborted.
35
+ `);return}u(await f(`Deleting`,async()=>a(s,`DELETE`,`/accounts/${c}/magic/gre_tunnels/${encodeURIComponent(String(t[`gre-tunnel-id`]))}`,{headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Deleted`})}};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 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 Xn={command:`get <gre-tunnel-id>`,describe:`Lists informtion for a specific GRE tunnel.`,builder:Yn,handler:async t=>{let n={};if(t[`x-magic-new-hc-target`]!==void 0&&(n[`x-magic-new-hc-target`]=String(t[`x-magic-new-hc-target`])),t.dryRun){d({command:`cf magic-transit gre-tunnels get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/gre_tunnels/${t[`gre-tunnel-id`]==null?`<gre-tunnel-id>`:encodeURIComponent(String(t[`gre-tunnel-id`]))}`,pathParams:{"gre-tunnel-id":String(t[`gre-tunnel-id`]??``)},bodyKind:`none`});return}let r=await o(t),s=t.local?m:await i(r);t.accountId=s,u(await f(`Loading`,async()=>a(r,`GET`,`/accounts/${s}/magic/gre_tunnels/${encodeURIComponent(String(t[`gre-tunnel-id`]))}`,{headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Loaded`})}};function Zn(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 Qn={command:`list`,describe:`Lists GRE tunnels associated with an account.`,builder:Zn,handler:async t=>{let n={};if(t[`x-magic-new-hc-target`]!==void 0&&(n[`x-magic-new-hc-target`]=String(t[`x-magic-new-hc-target`])),t.dryRun){d({command:`cf magic-transit gre-tunnels list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/gre_tunnels`,pathParams:{},bodyKind:`none`});return}let r=await o(t),s=t.local?m:await i(r);t.accountId=s,u(await f(`Loading`,async()=>a(r,`GET`,`/accounts/${s}/magic/gre_tunnels`,{headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Loaded`})}};function $n(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 er={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:$n,handler:async n=>{let r={};if(n[`x-magic-new-hc-target`]!==void 0&&(r[`x-magic-new-hc-target`]=String(n[`x-magic-new-hc-target`])),n.dryRun){d({command:`cf magic-transit gre-tunnels update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/gre_tunnels/${n[`gre-tunnel-id`]==null?`<gre-tunnel-id>`:encodeURIComponent(String(n[`gre-tunnel-id`]))}`,pathParams:{"gre-tunnel-id":String(n[`gre-tunnel-id`]??``)},bodyKind:`json`,body:n.body===void 0?l({automatic_return_routing:n[`automatic-return-routing`],cloudflare_gre_endpoint:p(n[`cloudflare-gre-endpoint`],`cloudflare-gre-endpoint`,`text`),customer_gre_endpoint:p(n[`customer-gre-endpoint`],`customer-gre-endpoint`,`text`),description:p(n.description,`description`,`text`),health_check:{enabled:n[`health-check-enabled`],rate:p(n[`health-check-rate`],`health-check-rate`,`text`),target:{saved:p(n[`health-check-target-saved`],`health-check-target-saved`,`text`)},type:p(n[`health-check-type`],`health-check-type`,`text`),direction:p(n[`health-check-direction`],`health-check-direction`,`text`)},interface_address:p(n[`interface-address`],`interface-address`,`text`),interface_address6:p(n[`interface-address6`],`interface-address6`,`text`),mtu:n.mtu,name:p(n.name,`name`,`text`),ttl:n.ttl}):s(n.body)});return}let h=await o(n),g=n.local?m:await i(h);if(n.accountId=g,n.body){let e=s(n.body);u(await f(`Updating`,async()=>a(h,`PUT`,`/accounts/${g}/magic/gre_tunnels/${encodeURIComponent(String(n[`gre-tunnel-id`]))}`,{body:e,headers:Object.keys(r).length>0?r:void 0})),{successLabel:`Updated`});return}n[`cloudflare-gre-endpoint`]===void 0&&(n[`cloudflare-gre-endpoint`]=await t(`cloudflare-gre-endpoint`,`The IP address assigned to the Cloudflare side of the GRE tunnel.`)),n[`customer-gre-endpoint`]===void 0&&(n[`customer-gre-endpoint`]=await t(`customer-gre-endpoint`,`The IP address assigned to the customer side of the GRE tunnel.`)),n[`interface-address`]===void 0&&(n[`interface-address`]=await t(`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.`)),n.name===void 0&&(n.name=await t(`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 _={};n[`automatic-return-routing`]!==void 0&&c(_,[`automatic_return_routing`],n[`automatic-return-routing`]),n[`cloudflare-gre-endpoint`]!==void 0&&c(_,[`cloudflare_gre_endpoint`],p(n[`cloudflare-gre-endpoint`],`cloudflare-gre-endpoint`,`text`)),n[`customer-gre-endpoint`]!==void 0&&c(_,[`customer_gre_endpoint`],p(n[`customer-gre-endpoint`],`customer-gre-endpoint`,`text`)),n.description!==void 0&&c(_,[`description`],p(n.description,`description`,`text`)),n[`health-check-enabled`]!==void 0&&c(_,[`health_check`,`enabled`],n[`health-check-enabled`]),n[`health-check-rate`]!==void 0&&c(_,[`health_check`,`rate`],p(n[`health-check-rate`],`health-check-rate`,`text`)),n[`health-check-target-saved`]!==void 0&&c(_,[`health_check`,`target`,`saved`],p(n[`health-check-target-saved`],`health-check-target-saved`,`text`)),n[`health-check-type`]!==void 0&&c(_,[`health_check`,`type`],p(n[`health-check-type`],`health-check-type`,`text`)),n[`health-check-direction`]!==void 0&&c(_,[`health_check`,`direction`],p(n[`health-check-direction`],`health-check-direction`,`text`)),n[`interface-address`]!==void 0&&c(_,[`interface_address`],p(n[`interface-address`],`interface-address`,`text`)),n[`interface-address6`]!==void 0&&c(_,[`interface_address6`],p(n[`interface-address6`],`interface-address6`,`text`)),n.mtu!==void 0&&c(_,[`mtu`],n.mtu),n.name!==void 0&&c(_,[`name`],p(n.name,`name`,`text`)),n.ttl!==void 0&&c(_,[`ttl`],n.ttl),u(await f(`Updating`,async()=>a(h,`PUT`,`/accounts/${g}/magic/gre_tunnels/${encodeURIComponent(String(n[`gre-tunnel-id`]))}`,{body:Object.keys(_).length>0?_:void 0,headers:Object.keys(r).length>0?r:void 0})),{successLabel:`Updated`})}},tr={command:`gre-tunnels`,describe:`Operations for gre-tunnels`,builder:e=>e.command(Wn).command(Kn).command(Jn).command(Xn).command(Qn).command(er).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function nr(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 rr={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:nr,handler:async t=>{let n={};if(t[`x-magic-new-hc-target`]!==void 0&&(n[`x-magic-new-hc-target`]=String(t[`x-magic-new-hc-target`])),t.dryRun){d({command:`cf magic-transit ipsec-tunnels bulk-update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/ipsec_tunnels`,pathParams:{},bodyKind:`json`,body:t.body===void 0?void 0:s(t.body)});return}let r=await o(t),c=t.local?m:await i(r);if(t.accountId=c,t.body){let e=s(t.body);u(await f(`Updating`,async()=>a(r,`PUT`,`/accounts/${c}/magic/ipsec_tunnels`,{body:e,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated`});return}u(await f(`Updating`,async()=>a(r,`PUT`,`/accounts/${c}/magic/ipsec_tunnels`,{headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated`})}};function ir(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.
36
+
37
+ Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the
38
+ key is not treated as a secret value. This is *only* supported for preventing
39
+ misconfiguration, not for defending against malicious attacks.
40
+
41
+ The MD5 key, if set, must be of non-zero length and consist only of the following types of
42
+ character:
43
+
44
+ * ASCII alphanumerics: \`[a-zA-Z0-9]\`
45
+ * Special characters in the set \`'!@#$%^&*()+[]{}<>/.,;:_-~\`= \\|\`
46
+
47
+ In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A),
48
+ quotation mark (\`"\`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed
49
+ (0x0C), and the question mark (\`?\`). Requests specifying an MD5 key with one or more of
50
+ 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
51
+ generated IKE IDs can still be used even if this custom value is specified.
52
+
53
+ Must be of the form \`<custom label>.<account ID>.custom.ipsec.cloudflare.com\`.
54
+
55
+ This custom ID does not need to be unique. Two IPsec tunnels may have the same custom
56
+ fqdn_id. However, if another IPsec tunnel has the same value then the two tunnels
57
+ 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 ar={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:ir,handler:async n=>{let r={};if(n[`x-magic-new-hc-target`]!==void 0&&(r[`x-magic-new-hc-target`]=String(n[`x-magic-new-hc-target`])),n.dryRun){d({command:`cf magic-transit ipsec-tunnels create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/ipsec_tunnels`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({automatic_return_routing:n[`automatic-return-routing`],bgp:{customer_asn:n[`bgp-customer-asn`],export_filter_id:p(n[`bgp-export-filter-id`],`bgp-export-filter-id`,`text`),extra_prefixes:n[`bgp-extra-prefixes`],import_filter_id:p(n[`bgp-import-filter-id`],`bgp-import-filter-id`,`text`),md5_key:p(n[`bgp-md5-key`],`bgp-md5-key`,`text`)},cloudflare_endpoint:p(n[`cloudflare-endpoint`],`cloudflare-endpoint`,`text`),custom_remote_identities:{fqdn_id:p(n[`custom-remote-identities-fqdn-id`],`custom-remote-identities-fqdn-id`,`text`)},customer_endpoint:p(n[`customer-endpoint`],`customer-endpoint`,`text`),description:p(n.description,`description`,`text`),health_check:{enabled:n[`health-check-enabled`],rate:p(n[`health-check-rate`],`health-check-rate`,`text`),target:{saved:p(n[`health-check-target-saved`],`health-check-target-saved`,`text`)},type:p(n[`health-check-type`],`health-check-type`,`text`),direction:p(n[`health-check-direction`],`health-check-direction`,`text`)},interface_address:p(n[`interface-address`],`interface-address`,`text`),interface_address6:p(n[`interface-address6`],`interface-address6`,`text`),name:p(n.name,`name`,`text`),psk:p(n.psk,`psk`,`text`),replay_protection:n[`replay-protection`]}):s(n.body)});return}let h=await o(n),g=n.local?m:await i(h);if(n.accountId=g,n.body){let e=s(n.body);u(await f(`Creating`,async()=>a(h,`POST`,`/accounts/${g}/magic/ipsec_tunnels`,{body:e,headers:Object.keys(r).length>0?r:void 0})),{successLabel:`Created`});return}n[`cloudflare-endpoint`]===void 0&&(n[`cloudflare-endpoint`]=await t(`cloudflare-endpoint`,`The IP address assigned to the Cloudflare side of the IPsec tunnel.`)),n[`interface-address`]===void 0&&(n[`interface-address`]=await t(`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.`)),n.name===void 0&&(n.name=await t(`name`,`The name of the IPsec tunnel. The name cannot share a name with other tunnels.`));let _={};n[`automatic-return-routing`]!==void 0&&c(_,[`automatic_return_routing`],n[`automatic-return-routing`]),n[`bgp-customer-asn`]!==void 0&&c(_,[`bgp`,`customer_asn`],n[`bgp-customer-asn`]),n[`bgp-export-filter-id`]!==void 0&&c(_,[`bgp`,`export_filter_id`],p(n[`bgp-export-filter-id`],`bgp-export-filter-id`,`text`)),n[`bgp-extra-prefixes`]!==void 0&&c(_,[`bgp`,`extra_prefixes`],n[`bgp-extra-prefixes`]),n[`bgp-import-filter-id`]!==void 0&&c(_,[`bgp`,`import_filter_id`],p(n[`bgp-import-filter-id`],`bgp-import-filter-id`,`text`)),n[`bgp-md5-key`]!==void 0&&c(_,[`bgp`,`md5_key`],p(n[`bgp-md5-key`],`bgp-md5-key`,`text`)),n[`cloudflare-endpoint`]!==void 0&&c(_,[`cloudflare_endpoint`],p(n[`cloudflare-endpoint`],`cloudflare-endpoint`,`text`)),n[`custom-remote-identities-fqdn-id`]!==void 0&&c(_,[`custom_remote_identities`,`fqdn_id`],p(n[`custom-remote-identities-fqdn-id`],`custom-remote-identities-fqdn-id`,`text`)),n[`customer-endpoint`]!==void 0&&c(_,[`customer_endpoint`],p(n[`customer-endpoint`],`customer-endpoint`,`text`)),n.description!==void 0&&c(_,[`description`],p(n.description,`description`,`text`)),n[`health-check-enabled`]!==void 0&&c(_,[`health_check`,`enabled`],n[`health-check-enabled`]),n[`health-check-rate`]!==void 0&&c(_,[`health_check`,`rate`],p(n[`health-check-rate`],`health-check-rate`,`text`)),n[`health-check-target-saved`]!==void 0&&c(_,[`health_check`,`target`,`saved`],p(n[`health-check-target-saved`],`health-check-target-saved`,`text`)),n[`health-check-type`]!==void 0&&c(_,[`health_check`,`type`],p(n[`health-check-type`],`health-check-type`,`text`)),n[`health-check-direction`]!==void 0&&c(_,[`health_check`,`direction`],p(n[`health-check-direction`],`health-check-direction`,`text`)),n[`interface-address`]!==void 0&&c(_,[`interface_address`],p(n[`interface-address`],`interface-address`,`text`)),n[`interface-address6`]!==void 0&&c(_,[`interface_address6`],p(n[`interface-address6`],`interface-address6`,`text`)),n.name!==void 0&&c(_,[`name`],p(n.name,`name`,`text`)),n.psk!==void 0&&c(_,[`psk`],p(n.psk,`psk`,`text`)),n[`replay-protection`]!==void 0&&c(_,[`replay_protection`],n[`replay-protection`]),u(await f(`Creating`,async()=>a(h,`POST`,`/accounts/${g}/magic/ipsec_tunnels`,{body:Object.keys(_).length>0?_:void 0,headers:Object.keys(r).length>0?r:void 0})),{successLabel:`Created`})}};function or(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 sr={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:or,handler:async t=>{let n={};if(t[`x-magic-new-hc-target`]!==void 0&&(n[`x-magic-new-hc-target`]=String(t[`x-magic-new-hc-target`])),t.dryRun){d({command:`cf magic-transit ipsec-tunnels delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/ipsec_tunnels/${t[`ipsec-tunnel-id`]==null?`<ipsec-tunnel-id>`:encodeURIComponent(String(t[`ipsec-tunnel-id`]))}`,pathParams:{"ipsec-tunnel-id":String(t[`ipsec-tunnel-id`]??``)},bodyKind:`none`});return}let s=await o(t),c=t.local?m:await i(s);if(t.accountId=c,!await r({force:!!t.force})){process.stderr.write(`Aborted.
58
+ `);return}u(await f(`Deleting`,async()=>a(s,`DELETE`,`/accounts/${c}/magic/ipsec_tunnels/${encodeURIComponent(String(t[`ipsec-tunnel-id`]))}`,{headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Deleted`})}};function cr(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 lr={command:`get <ipsec-tunnel-id>`,describe:`Lists details for a specific IPsec tunnel.`,builder:cr,handler:async t=>{let n={};if(t[`x-magic-new-hc-target`]!==void 0&&(n[`x-magic-new-hc-target`]=String(t[`x-magic-new-hc-target`])),t.dryRun){d({command:`cf magic-transit ipsec-tunnels get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/ipsec_tunnels/${t[`ipsec-tunnel-id`]==null?`<ipsec-tunnel-id>`:encodeURIComponent(String(t[`ipsec-tunnel-id`]))}`,pathParams:{"ipsec-tunnel-id":String(t[`ipsec-tunnel-id`]??``)},bodyKind:`none`});return}let r=await o(t),s=t.local?m:await i(r);t.accountId=s,u(await f(`Loading`,async()=>a(r,`GET`,`/accounts/${s}/magic/ipsec_tunnels/${encodeURIComponent(String(t[`ipsec-tunnel-id`]))}`,{headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Loaded`})}};function ur(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 dr={command:`list`,describe:`Lists IPsec tunnels associated with an account.`,builder:ur,handler:async t=>{let n={};if(t[`x-magic-new-hc-target`]!==void 0&&(n[`x-magic-new-hc-target`]=String(t[`x-magic-new-hc-target`])),t.dryRun){d({command:`cf magic-transit ipsec-tunnels list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/ipsec_tunnels`,pathParams:{},bodyKind:`none`});return}let r=await o(t),s=t.local?m:await i(r);t.accountId=s,u(await f(`Loading`,async()=>a(r,`GET`,`/accounts/${s}/magic/ipsec_tunnels`,{headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Loaded`})}};function fr(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 pr={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:fr,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit ipsec-tunnels psk-generate`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/ipsec_tunnels/${t[`ipsec-tunnel-id`]==null?`<ipsec-tunnel-id>`:encodeURIComponent(String(t[`ipsec-tunnel-id`]))}/psk_generate`,pathParams:{"ipsec-tunnel-id":String(t[`ipsec-tunnel-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,u(await f(`Creating`,async()=>n.magicTransit.ipsecTunnels.pskGenerate({account_id:r,ipsec_tunnel_id:t[`ipsec-tunnel-id`]})),{successLabel:`Created`})}};function mr(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.
59
+
60
+ Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the
61
+ key is not treated as a secret value. This is *only* supported for preventing
62
+ misconfiguration, not for defending against malicious attacks.
63
+
64
+ The MD5 key, if set, must be of non-zero length and consist only of the following types of
65
+ character:
66
+
67
+ * ASCII alphanumerics: \`[a-zA-Z0-9]\`
68
+ * Special characters in the set \`'!@#$%^&*()+[]{}<>/.,;:_-~\`= \\|\`
69
+
70
+ In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A),
71
+ quotation mark (\`"\`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed
72
+ (0x0C), and the question mark (\`?\`). Requests specifying an MD5 key with one or more of
73
+ 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
74
+ generated IKE IDs can still be used even if this custom value is specified.
75
+
76
+ Must be of the form \`<custom label>.<account ID>.custom.ipsec.cloudflare.com\`.
77
+
78
+ This custom ID does not need to be unique. Two IPsec tunnels may have the same custom
79
+ fqdn_id. However, if another IPsec tunnel has the same value then the two tunnels
80
+ 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 hr={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:mr,handler:async n=>{let r={};if(n[`x-magic-new-hc-target`]!==void 0&&(r[`x-magic-new-hc-target`]=String(n[`x-magic-new-hc-target`])),n.dryRun){d({command:`cf magic-transit ipsec-tunnels update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/ipsec_tunnels/${n[`ipsec-tunnel-id`]==null?`<ipsec-tunnel-id>`:encodeURIComponent(String(n[`ipsec-tunnel-id`]))}`,pathParams:{"ipsec-tunnel-id":String(n[`ipsec-tunnel-id`]??``)},bodyKind:`json`,body:n.body===void 0?l({automatic_return_routing:n[`automatic-return-routing`],bgp:{customer_asn:n[`bgp-customer-asn`],export_filter_id:p(n[`bgp-export-filter-id`],`bgp-export-filter-id`,`text`),extra_prefixes:n[`bgp-extra-prefixes`],import_filter_id:p(n[`bgp-import-filter-id`],`bgp-import-filter-id`,`text`),md5_key:p(n[`bgp-md5-key`],`bgp-md5-key`,`text`)},cloudflare_endpoint:p(n[`cloudflare-endpoint`],`cloudflare-endpoint`,`text`),custom_remote_identities:{fqdn_id:p(n[`custom-remote-identities-fqdn-id`],`custom-remote-identities-fqdn-id`,`text`)},customer_endpoint:p(n[`customer-endpoint`],`customer-endpoint`,`text`),description:p(n.description,`description`,`text`),health_check:{enabled:n[`health-check-enabled`],rate:p(n[`health-check-rate`],`health-check-rate`,`text`),target:{saved:p(n[`health-check-target-saved`],`health-check-target-saved`,`text`)},type:p(n[`health-check-type`],`health-check-type`,`text`),direction:p(n[`health-check-direction`],`health-check-direction`,`text`)},interface_address:p(n[`interface-address`],`interface-address`,`text`),interface_address6:p(n[`interface-address6`],`interface-address6`,`text`),name:p(n.name,`name`,`text`),psk:p(n.psk,`psk`,`text`),replay_protection:n[`replay-protection`]}):s(n.body)});return}let h=await o(n),g=n.local?m:await i(h);if(n.accountId=g,n.body){let e=s(n.body);u(await f(`Updating`,async()=>a(h,`PUT`,`/accounts/${g}/magic/ipsec_tunnels/${encodeURIComponent(String(n[`ipsec-tunnel-id`]))}`,{body:e,headers:Object.keys(r).length>0?r:void 0})),{successLabel:`Updated`});return}n[`cloudflare-endpoint`]===void 0&&(n[`cloudflare-endpoint`]=await t(`cloudflare-endpoint`,`The IP address assigned to the Cloudflare side of the IPsec tunnel.`)),n[`interface-address`]===void 0&&(n[`interface-address`]=await t(`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.`)),n.name===void 0&&(n.name=await t(`name`,`The name of the IPsec tunnel. The name cannot share a name with other tunnels.`));let _={};n[`automatic-return-routing`]!==void 0&&c(_,[`automatic_return_routing`],n[`automatic-return-routing`]),n[`bgp-customer-asn`]!==void 0&&c(_,[`bgp`,`customer_asn`],n[`bgp-customer-asn`]),n[`bgp-export-filter-id`]!==void 0&&c(_,[`bgp`,`export_filter_id`],p(n[`bgp-export-filter-id`],`bgp-export-filter-id`,`text`)),n[`bgp-extra-prefixes`]!==void 0&&c(_,[`bgp`,`extra_prefixes`],n[`bgp-extra-prefixes`]),n[`bgp-import-filter-id`]!==void 0&&c(_,[`bgp`,`import_filter_id`],p(n[`bgp-import-filter-id`],`bgp-import-filter-id`,`text`)),n[`bgp-md5-key`]!==void 0&&c(_,[`bgp`,`md5_key`],p(n[`bgp-md5-key`],`bgp-md5-key`,`text`)),n[`cloudflare-endpoint`]!==void 0&&c(_,[`cloudflare_endpoint`],p(n[`cloudflare-endpoint`],`cloudflare-endpoint`,`text`)),n[`custom-remote-identities-fqdn-id`]!==void 0&&c(_,[`custom_remote_identities`,`fqdn_id`],p(n[`custom-remote-identities-fqdn-id`],`custom-remote-identities-fqdn-id`,`text`)),n[`customer-endpoint`]!==void 0&&c(_,[`customer_endpoint`],p(n[`customer-endpoint`],`customer-endpoint`,`text`)),n.description!==void 0&&c(_,[`description`],p(n.description,`description`,`text`)),n[`health-check-enabled`]!==void 0&&c(_,[`health_check`,`enabled`],n[`health-check-enabled`]),n[`health-check-rate`]!==void 0&&c(_,[`health_check`,`rate`],p(n[`health-check-rate`],`health-check-rate`,`text`)),n[`health-check-target-saved`]!==void 0&&c(_,[`health_check`,`target`,`saved`],p(n[`health-check-target-saved`],`health-check-target-saved`,`text`)),n[`health-check-type`]!==void 0&&c(_,[`health_check`,`type`],p(n[`health-check-type`],`health-check-type`,`text`)),n[`health-check-direction`]!==void 0&&c(_,[`health_check`,`direction`],p(n[`health-check-direction`],`health-check-direction`,`text`)),n[`interface-address`]!==void 0&&c(_,[`interface_address`],p(n[`interface-address`],`interface-address`,`text`)),n[`interface-address6`]!==void 0&&c(_,[`interface_address6`],p(n[`interface-address6`],`interface-address6`,`text`)),n.name!==void 0&&c(_,[`name`],p(n.name,`name`,`text`)),n.psk!==void 0&&c(_,[`psk`],p(n.psk,`psk`,`text`)),n[`replay-protection`]!==void 0&&c(_,[`replay_protection`],n[`replay-protection`]),u(await f(`Updating`,async()=>a(h,`PUT`,`/accounts/${g}/magic/ipsec_tunnels/${encodeURIComponent(String(n[`ipsec-tunnel-id`]))}`,{body:Object.keys(_).length>0?_:void 0,headers:Object.keys(r).length>0?r:void 0})),{successLabel:`Updated`})}},gr={command:`ipsec-tunnels`,describe:`Operations for ipsec-tunnels`,builder:e=>e.command(rr).command(ar).command(sr).command(lr).command(dr).command(pr).command(hr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function _r(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 vr={command:`create`,describe:`Create new PCAP request for account.`,builder:_r,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit pcaps create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/pcaps`,pathParams:{},bodyKind:`json`,body:t.body===void 0?void 0:s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Creating`,async()=>n.magicTransit.pcaps.create({body:e,account_id:r})),{successLabel:`Created`});return}if(t.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.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 br={command:`get <pcap-id>`,describe:`Download PCAP information into a file. Response is a binary PCAP file.`,builder:yr,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit pcaps download get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/pcaps/${t[`pcap-id`]==null?`<pcap-id>`:encodeURIComponent(String(t[`pcap-id`]))}/download`,pathParams:{"pcap-id":String(t[`pcap-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r;let a=await f(`Loading`,async()=>_(`/accounts/${r}/pcaps/${encodeURIComponent(String(t[`pcap-id`]))}/download`,{method:`GET`,localEndpoint:t.local?t.localEndpoint:void 0}));g(t.text===!0?a.toString(`utf-8`):a)}},xr={command:`download`,describe:`Packet capture requests for debugging traffic flowing through Magic Transit tunnels`,builder:e=>e.command(br).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Sr(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 Cr={command:`get <pcap-id>`,describe:`Get information for a PCAP request by id.`,builder:Sr,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit pcaps get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/pcaps/${t[`pcap-id`]==null?`<pcap-id>`:encodeURIComponent(String(t[`pcap-id`]))}`,pathParams:{"pcap-id":String(t[`pcap-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,u(await f(`Loading`,async()=>n.magicTransit.pcaps.get({account_id:r,pcap_id:t[`pcap-id`]})),{successLabel:`Loaded`})}};function wr(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Tr={command:`list`,describe:`Lists all packet capture requests for an account.`,builder:wr,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit pcaps list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/pcaps`,pathParams:{},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,u(await f(`Loading`,async()=>n.magicTransit.pcaps.list({account_id:r})),{successLabel:`Loaded`})}};function Er(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 Dr={command:`create`,describe:`Adds an AWS or GCP bucket to use with full packet captures.`,builder:Er,handler:async n=>{if(n.dryRun){d({command:`cf magic-transit pcaps ownership create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/pcaps/ownership`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({destination_conf:p(n[`destination-conf`],`destination-conf`,`text`)}):s(n.body)});return}let r=await o(n),a=n.local?m:await i(r);if(n.accountId=a,n.body){let e=s(n.body);u(await f(`Creating`,async()=>r.magicTransit.pcaps.ownership.create({...e,account_id:a})),{successLabel:`Created`});return}n[`destination-conf`]===void 0&&(n[`destination-conf`]=await t(`destination-conf`,"The full URI for the bucket. This field only applies to `full` packet captures."));let c=l({destination_conf:p(n[`destination-conf`],`destination-conf`,`text`)});u(await f(`Creating`,async()=>r.magicTransit.pcaps.ownership.create({...c,account_id:a})),{successLabel:`Created`})}};function Or(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 kr={command:`delete <ownership-id>`,describe:`Deletes buckets added to the packet captures API.`,builder:Or,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit pcaps ownership delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/pcaps/ownership/${t[`ownership-id`]==null?`<ownership-id>`:encodeURIComponent(String(t[`ownership-id`]))}`,pathParams:{"ownership-id":String(t[`ownership-id`]??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
81
+ `);return}u(await f(`Deleting`,async()=>n.magicTransit.pcaps.ownership.delete({account_id:a,ownership_id:t[`ownership-id`]})),{successLabel:`Deleted`})}};function Ar(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const jr={command:`get`,describe:`List all buckets configured for use with PCAPs API.`,builder:Ar,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit pcaps ownership get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/pcaps/ownership`,pathParams:{},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,u(await f(`Loading`,async()=>n.magicTransit.pcaps.ownership.get({account_id:r})),{successLabel:`Loaded`})}};function Mr(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 Nr={command:`validate`,describe:`Validates buckets added to the packet captures API.`,builder:Mr,handler:async n=>{if(n.dryRun){d({command:`cf magic-transit pcaps ownership validate`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/pcaps/ownership/validate`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({destination_conf:p(n[`destination-conf`],`destination-conf`,`text`),ownership_challenge:p(n[`ownership-challenge`],`ownership-challenge`,`text`)}):s(n.body)});return}let r=await o(n),a=n.local?m:await i(r);if(n.accountId=a,n.body){let e=s(n.body);u(await f(`Creating`,async()=>r.magicTransit.pcaps.ownership.validate({...e,account_id:a})),{successLabel:`Created`});return}n[`destination-conf`]===void 0&&(n[`destination-conf`]=await t(`destination-conf`,"The full URI for the bucket. This field only applies to `full` packet captures.")),n[`ownership-challenge`]===void 0&&(n[`ownership-challenge`]=await t(`ownership-challenge`,`The ownership challenge filename stored in the bucket.`));let c=l({destination_conf:p(n[`destination-conf`],`destination-conf`,`text`),ownership_challenge:p(n[`ownership-challenge`],`ownership-challenge`,`text`)});u(await f(`Creating`,async()=>r.magicTransit.pcaps.ownership.validate({...c,account_id:a})),{successLabel:`Created`})}},Pr={command:`ownership`,describe:`Packet capture requests for debugging traffic flowing through Magic Transit tunnels`,builder:e=>e.command(Dr).command(kr).command(jr).command(Nr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Fr(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 Ir={command:`stop <pcap-id>`,describe:`Stop full PCAP.`,builder:Fr,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit pcaps stop`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/pcaps/${t[`pcap-id`]==null?`<pcap-id>`:encodeURIComponent(String(t[`pcap-id`]))}/stop`,pathParams:{"pcap-id":String(t[`pcap-id`]??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force,message:`This operation halts an in-progress full packet capture. Any unsaved capture data will be lost.`})){process.stderr.write(`Aborted.
82
+ `);return}u(await f(`Deleting`,async()=>n.magicTransit.pcaps.stop({account_id:a,pcap_id:t[`pcap-id`]})),{successLabel:`Deleted`})}},Lr={command:`pcaps`,describe:`Packet capture requests for debugging traffic flowing through Magic Transit tunnels`,builder:e=>e.command(vr).command(Cr).command(Tr).command(Ir).command(xr).command(Pr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Rr(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 zr={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:Rr,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit routes bulk-update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/routes`,pathParams:{},bodyKind:`json`,body:t.body===void 0?void 0:s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Updating`,async()=>n.magicTransit.routes.bulkUpdate({...e,account_id:r})),{successLabel:`Updated`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function Br(e){return e.option(`description`,{type:`string`,description:`An optional human provided description of the static route.`}).option(`nexthop`,{type:`string`,description:`The next-hop IP Address for the static route.`}).option(`prefix`,{type:`string`,description:`IP Prefix in Classless Inter-Domain Routing format.`}).option(`priority`,{type:`number`,description:`Priority of the static route.`}).option(`scope-colo-names`,{type:`string`,array:!0,description:`List of colo names for the ECMP scope.`}).option(`scope-colo-regions`,{type:`string`,array:!0,description:`List of colo regions for the ECMP scope.`}).option(`weight`,{type:`number`,description:`Optional weight of the ECMP scope - if provided.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Vr={command:`create`,describe:"Creates a new Magic static route. Use `?validate_only=true` as an optional query parameter to run validation only without persisting changes.",builder:Br,handler:async n=>{if(n.dryRun){d({command:`cf magic-transit routes create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/routes`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({description:p(n.description,`description`,`text`),nexthop:p(n.nexthop,`nexthop`,`text`),prefix:p(n.prefix,`prefix`,`text`),priority:n.priority,scope:{colo_names:n[`scope-colo-names`],colo_regions:n[`scope-colo-regions`]},weight:n.weight}):s(n.body)});return}let r=await o(n),a=n.local?m:await i(r);if(n.accountId=a,n.body){let e=s(n.body);u(await f(`Creating`,async()=>r.magicTransit.routes.create({...e,account_id:a})),{successLabel:`Created`});return}if(n.nexthop===void 0&&(n.nexthop=await t(`nexthop`,`The next-hop IP Address for the static route.`)),n.prefix===void 0&&(n.prefix=await t(`prefix`,`IP Prefix in Classless Inter-Domain Routing format.`)),n.priority===void 0)throw Error(`--priority is required (or pass --body with this field set).`);let c=l({description:p(n.description,`description`,`text`),nexthop:p(n.nexthop,`nexthop`,`text`),prefix:p(n.prefix,`prefix`,`text`),priority:n.priority,scope:{colo_names:n[`scope-colo-names`],colo_regions:n[`scope-colo-regions`]},weight:n.weight});u(await f(`Creating`,async()=>r.magicTransit.routes.create({...c,account_id:a})),{successLabel:`Created`})}};function Hr(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 Ur={command:`delete <route-id>`,describe:`Disable and remove a specific Magic static route.`,builder:Hr,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit routes delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/routes/${t[`route-id`]==null?`<route-id>`:encodeURIComponent(String(t[`route-id`]))}`,pathParams:{"route-id":String(t[`route-id`]??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
83
+ `);return}u(await f(`Deleting`,async()=>n.magicTransit.routes.delete({account_id:a,route_id:t[`route-id`]})),{successLabel:`Deleted`})}};function Wr(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Gr={command:`empty`,describe:`Delete multiple Magic static routes.`,builder:Wr,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit routes empty`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/routes`,pathParams:{},bodyKind:`json`,body:t.body===void 0?void 0:s(t.body)});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
84
+ `);return}if(t.body){let e=s(t.body);u(await f(`Deleting`,async()=>n.magicTransit.routes.empty({...e,account_id:a})),{successLabel:`Deleted`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function Kr(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 qr={command:`get <route-id>`,describe:`Get a specific Magic static route.`,builder:Kr,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit routes get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/routes/${t[`route-id`]==null?`<route-id>`:encodeURIComponent(String(t[`route-id`]))}`,pathParams:{"route-id":String(t[`route-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,u(await f(`Loading`,async()=>n.magicTransit.routes.get({account_id:r,route_id:t[`route-id`]})),{successLabel:`Loaded`})}};function Jr(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Yr={command:`list`,describe:`List all Magic static routes.`,builder:Jr,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit routes list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/routes`,pathParams:{},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,u(await f(`Loading`,async()=>n.magicTransit.routes.list({account_id:r})),{successLabel:`Loaded`})}};function Xr(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 Zr={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:Xr,handler:async n=>{if(n.dryRun){d({command:`cf magic-transit routes update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/routes/${n[`route-id`]==null?`<route-id>`:encodeURIComponent(String(n[`route-id`]))}`,pathParams:{"route-id":String(n[`route-id`]??``)},bodyKind:`json`,body:n.body===void 0?l({description:p(n.description,`description`,`text`),nexthop:p(n.nexthop,`nexthop`,`text`),prefix:p(n.prefix,`prefix`,`text`),priority:n.priority,scope:{colo_names:n[`scope-colo-names`],colo_regions:n[`scope-colo-regions`]},weight:n.weight}):s(n.body)});return}let r=await o(n),a=n.local?m:await i(r);if(n.accountId=a,n.body){let e=s(n.body);u(await f(`Updating`,async()=>r.magicTransit.routes.update({body:e,account_id:a,route_id:n[`route-id`]})),{successLabel:`Updated`});return}if(n.nexthop===void 0&&(n.nexthop=await t(`nexthop`,`The next-hop IP Address for the static route.`)),n.prefix===void 0&&(n.prefix=await t(`prefix`,`IP Prefix in Classless Inter-Domain Routing format.`)),n.priority===void 0)throw Error(`--priority is required (or pass --body with this field set).`);let c=l({description:p(n.description,`description`,`text`),nexthop:p(n.nexthop,`nexthop`,`text`),prefix:p(n.prefix,`prefix`,`text`),priority:n.priority,scope:{colo_names:n[`scope-colo-names`],colo_regions:n[`scope-colo-regions`]},weight:n.weight});u(await f(`Updating`,async()=>r.magicTransit.routes.update({body:c,account_id:a,route_id:n[`route-id`]})),{successLabel:`Updated`})}},Qr={command:`routes`,describe:`Operations for routes`,builder:e=>e.command(zr).command(Vr).command(Ur).command(Gr).command(qr).command(Yr).command(Zr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function $r(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 ei={command:`create <site-id>`,describe:`Creates a new Site ACL.`,builder:$r,handler:async n=>{if(n.dryRun){d({command:`cf magic-transit sites acls create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${n[`site-id`]==null?`<site-id>`:encodeURIComponent(String(n[`site-id`]))}/acls`,pathParams:{"site-id":String(n[`site-id`]??``)},bodyKind:`json`,body:n.body===void 0?l({description:p(n.description,`description`,`text`),forward_locally:n[`forward-locally`],lan_1:{lan_id:p(n[`lan-1-lan-id`],`lan-1-lan-id`,`text`),lan_name:p(n[`lan-1-lan-name`],`lan-1-lan-name`,`text`),port_ranges:n[`lan-1-port-ranges`],ports:n[`lan-1-ports`]},lan_2:{lan_id:p(n[`lan-2-lan-id`],`lan-2-lan-id`,`text`),lan_name:p(n[`lan-2-lan-name`],`lan-2-lan-name`,`text`),port_ranges:n[`lan-2-port-ranges`],ports:n[`lan-2-ports`]},name:p(n.name,`name`,`text`),protocols:n.protocols,unidirectional:n.unidirectional}):s(n.body)});return}let r=await o(n),a=n.local?m:await i(r);if(n.accountId=a,n.body){let e=s(n.body);u(await f(`Creating`,async()=>r.magicTransit.sites.acls.create({...e,account_id:a,site_id:n[`site-id`]})),{successLabel:`Created`});return}n[`lan-1-lan-id`]===void 0&&(n[`lan-1-lan-id`]=await t(`lan-1-lan-id`,`The identifier for the LAN you want to create an ACL policy with.`)),n[`lan-2-lan-id`]===void 0&&(n[`lan-2-lan-id`]=await t(`lan-2-lan-id`,`The identifier for the LAN you want to create an ACL policy with.`)),n.name===void 0&&(n.name=await t(`name`,`The name of the ACL.`));let c=l({description:p(n.description,`description`,`text`),forward_locally:n[`forward-locally`],lan_1:{lan_id:p(n[`lan-1-lan-id`],`lan-1-lan-id`,`text`),lan_name:p(n[`lan-1-lan-name`],`lan-1-lan-name`,`text`),port_ranges:n[`lan-1-port-ranges`],ports:n[`lan-1-ports`]},lan_2:{lan_id:p(n[`lan-2-lan-id`],`lan-2-lan-id`,`text`),lan_name:p(n[`lan-2-lan-name`],`lan-2-lan-name`,`text`),port_ranges:n[`lan-2-port-ranges`],ports:n[`lan-2-ports`]},name:p(n.name,`name`,`text`),protocols:n.protocols,unidirectional:n.unidirectional});u(await f(`Creating`,async()=>r.magicTransit.sites.acls.create({...c,account_id:a,site_id:n[`site-id`]})),{successLabel:`Created`})}};function ti(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 ni={command:`delete <acl-id>`,describe:`Remove a specific Site ACL.`,builder:ti,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit sites acls delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}/acls/${t[`acl-id`]==null?`<acl-id>`:encodeURIComponent(String(t[`acl-id`]))}`,pathParams:{"site-id":String(t[`site-id`]??``),"acl-id":String(t[`acl-id`]??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
85
+ `);return}u(await f(`Deleting`,async()=>n.magicTransit.sites.acls.delete({account_id:a,site_id:t[`site-id`],acl_id:t[`acl-id`]})),{successLabel:`Deleted`})}};function ri(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 ii={command:`edit <acl-id>`,describe:`Patch a specific Site ACL.`,builder:ri,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit sites acls edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}/acls/${t[`acl-id`]==null?`<acl-id>`:encodeURIComponent(String(t[`acl-id`]))}`,pathParams:{"site-id":String(t[`site-id`]??``),"acl-id":String(t[`acl-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({description:p(t.description,`description`,`text`),forward_locally:t[`forward-locally`],lan_1:{lan_id:p(t[`lan-1-lan-id`],`lan-1-lan-id`,`text`),lan_name:p(t[`lan-1-lan-name`],`lan-1-lan-name`,`text`),port_ranges:t[`lan-1-port-ranges`],ports:t[`lan-1-ports`]},lan_2:{lan_id:p(t[`lan-2-lan-id`],`lan-2-lan-id`,`text`),lan_name:p(t[`lan-2-lan-name`],`lan-2-lan-name`,`text`),port_ranges:t[`lan-2-port-ranges`],ports:t[`lan-2-ports`]},name:p(t.name,`name`,`text`),protocols:t.protocols,unidirectional:t.unidirectional}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Updating`,async()=>n.magicTransit.sites.acls.edit({body:e,account_id:r,site_id:t[`site-id`],acl_id:t[`acl-id`]})),{successLabel:`Updated`});return}let a=l({description:p(t.description,`description`,`text`),forward_locally:t[`forward-locally`],lan_1:{lan_id:p(t[`lan-1-lan-id`],`lan-1-lan-id`,`text`),lan_name:p(t[`lan-1-lan-name`],`lan-1-lan-name`,`text`),port_ranges:t[`lan-1-port-ranges`],ports:t[`lan-1-ports`]},lan_2:{lan_id:p(t[`lan-2-lan-id`],`lan-2-lan-id`,`text`),lan_name:p(t[`lan-2-lan-name`],`lan-2-lan-name`,`text`),port_ranges:t[`lan-2-port-ranges`],ports:t[`lan-2-ports`]},name:p(t.name,`name`,`text`),protocols:t.protocols,unidirectional:t.unidirectional});u(await f(`Updating`,async()=>n.magicTransit.sites.acls.edit({body:a,account_id:r,site_id:t[`site-id`],acl_id:t[`acl-id`]})),{successLabel:`Updated`})}};function ai(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 oi={command:`get <acl-id>`,describe:`Get a specific Site ACL.`,builder:ai,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit sites acls get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}/acls/${t[`acl-id`]==null?`<acl-id>`:encodeURIComponent(String(t[`acl-id`]))}`,pathParams:{"site-id":String(t[`site-id`]??``),"acl-id":String(t[`acl-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,u(await f(`Loading`,async()=>n.magicTransit.sites.acls.get({account_id:r,site_id:t[`site-id`],acl_id:t[`acl-id`]})),{successLabel:`Loaded`})}};function si(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 ci={command:`list`,describe:`Lists Site ACLs associated with an account.`,builder:si,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit sites acls list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}/acls`,pathParams:{"site-id":String(t[`site-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,u(await f(`Loading`,async()=>n.magicTransit.sites.acls.list({account_id:r,site_id:t[`site-id`]})),{successLabel:`Loaded`})}};function li(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 ui={command:`update <acl-id>`,describe:`Update a specific Site ACL.`,builder:li,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit sites acls update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}/acls/${t[`acl-id`]==null?`<acl-id>`:encodeURIComponent(String(t[`acl-id`]))}`,pathParams:{"site-id":String(t[`site-id`]??``),"acl-id":String(t[`acl-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({description:p(t.description,`description`,`text`),forward_locally:t[`forward-locally`],lan_1:{lan_id:p(t[`lan-1-lan-id`],`lan-1-lan-id`,`text`),lan_name:p(t[`lan-1-lan-name`],`lan-1-lan-name`,`text`),port_ranges:t[`lan-1-port-ranges`],ports:t[`lan-1-ports`]},lan_2:{lan_id:p(t[`lan-2-lan-id`],`lan-2-lan-id`,`text`),lan_name:p(t[`lan-2-lan-name`],`lan-2-lan-name`,`text`),port_ranges:t[`lan-2-port-ranges`],ports:t[`lan-2-ports`]},name:p(t.name,`name`,`text`),protocols:t.protocols,unidirectional:t.unidirectional}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Updating`,async()=>n.magicTransit.sites.acls.update({body:e,account_id:r,site_id:t[`site-id`],acl_id:t[`acl-id`]})),{successLabel:`Updated`});return}let a=l({description:p(t.description,`description`,`text`),forward_locally:t[`forward-locally`],lan_1:{lan_id:p(t[`lan-1-lan-id`],`lan-1-lan-id`,`text`),lan_name:p(t[`lan-1-lan-name`],`lan-1-lan-name`,`text`),port_ranges:t[`lan-1-port-ranges`],ports:t[`lan-1-ports`]},lan_2:{lan_id:p(t[`lan-2-lan-id`],`lan-2-lan-id`,`text`),lan_name:p(t[`lan-2-lan-name`],`lan-2-lan-name`,`text`),port_ranges:t[`lan-2-port-ranges`],ports:t[`lan-2-ports`]},name:p(t.name,`name`,`text`),protocols:t.protocols,unidirectional:t.unidirectional});u(await f(`Updating`,async()=>n.magicTransit.sites.acls.update({body:a,account_id:r,site_id:t[`site-id`],acl_id:t[`acl-id`]})),{successLabel:`Updated`})}},di={command:`acls`,describe:`Operations for sites.acls`,builder:e=>e.command(ei).command(ni).command(ii).command(oi).command(ci).command(ui).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function fi(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 pi={command:`create <site-id>`,describe:`Creates a new App Config for a site`,builder:fi,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit sites app-configuration create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}/app_configs`,pathParams:{"site-id":String(t[`site-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({breakout:t.breakout,preferred_wans:t[`preferred-wans`],priority:t.priority}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Creating`,async()=>n.magicTransit.sites.appConfiguration.create({...e,account_id:r,site_id:t[`site-id`]})),{successLabel:`Created`});return}let a=l({breakout:t.breakout,preferred_wans:t[`preferred-wans`],priority:t.priority});u(await f(`Creating`,async()=>n.magicTransit.sites.appConfiguration.create({...a,account_id:r,site_id:t[`site-id`]})),{successLabel:`Created`})}};function mi(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 hi={command:`delete <app-config-id>`,describe:`Deletes specific App Config associated with a site.`,builder:mi,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit sites app-configuration delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}/app_configs/${t[`app-config-id`]==null?`<app-config-id>`:encodeURIComponent(String(t[`app-config-id`]))}`,pathParams:{"site-id":String(t[`site-id`]??``),"app-config-id":String(t[`app-config-id`]??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
86
+ `);return}u(await f(`Deleting`,async()=>n.magicTransit.sites.appConfiguration.delete({account_id:a,site_id:t[`site-id`],app_config_id:t[`app-config-id`]})),{successLabel:`Deleted`})}};function gi(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 _i={command:`edit <app-config-id>`,describe:`Updates an App Config for a site`,builder:gi,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit sites app-configuration edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}/app_configs/${t[`app-config-id`]==null?`<app-config-id>`:encodeURIComponent(String(t[`app-config-id`]))}`,pathParams:{"site-id":String(t[`site-id`]??``),"app-config-id":String(t[`app-config-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({account_app_id:p(t[`account-app-id`],`account-app-id`,`text`),breakout:t.breakout,managed_app_id:p(t[`managed-app-id`],`managed-app-id`,`text`),preferred_wans:t[`preferred-wans`],priority:t.priority}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Updating`,async()=>n.magicTransit.sites.appConfiguration.edit({body:e,account_id:r,site_id:t[`site-id`],app_config_id:t[`app-config-id`]})),{successLabel:`Updated`});return}let a=l({account_app_id:p(t[`account-app-id`],`account-app-id`,`text`),breakout:t.breakout,managed_app_id:p(t[`managed-app-id`],`managed-app-id`,`text`),preferred_wans:t[`preferred-wans`],priority:t.priority});u(await f(`Updating`,async()=>n.magicTransit.sites.appConfiguration.edit({body:a,account_id:r,site_id:t[`site-id`],app_config_id:t[`app-config-id`]})),{successLabel:`Updated`})}};function vi(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 App Configs associated with a site.`,builder:vi,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit sites app-configuration list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}/app_configs`,pathParams:{"site-id":String(t[`site-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,u(await f(`Loading`,async()=>n.magicTransit.sites.appConfiguration.list({account_id:r,site_id:t[`site-id`]})),{successLabel:`Loaded`})}};function bi(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 xi={command:`update <app-config-id>`,describe:`Updates an App Config for a site`,builder:bi,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit sites app-configuration update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}/app_configs/${t[`app-config-id`]==null?`<app-config-id>`:encodeURIComponent(String(t[`app-config-id`]))}`,pathParams:{"site-id":String(t[`site-id`]??``),"app-config-id":String(t[`app-config-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({account_app_id:p(t[`account-app-id`],`account-app-id`,`text`),breakout:t.breakout,managed_app_id:p(t[`managed-app-id`],`managed-app-id`,`text`),preferred_wans:t[`preferred-wans`],priority:t.priority}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Updating`,async()=>n.magicTransit.sites.appConfiguration.update({body:e,account_id:r,site_id:t[`site-id`],app_config_id:t[`app-config-id`]})),{successLabel:`Updated`});return}let a=l({account_app_id:p(t[`account-app-id`],`account-app-id`,`text`),breakout:t.breakout,managed_app_id:p(t[`managed-app-id`],`managed-app-id`,`text`),preferred_wans:t[`preferred-wans`],priority:t.priority});u(await f(`Updating`,async()=>n.magicTransit.sites.appConfiguration.update({body:a,account_id:r,site_id:t[`site-id`],app_config_id:t[`app-config-id`]})),{successLabel:`Updated`})}},Si={command:`app-configuration`,describe:`Operations for sites.app-configuration`,builder:e=>e.command(pi).command(hi).command(_i).command(yi).command(xi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ci(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 wi={command:`create`,describe:`Creates a new Site`,builder:Ci,handler:async n=>{if(n.dryRun){d({command:`cf magic-transit sites create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({connector_id:p(n[`connector-id`],`connector-id`,`text`),description:p(n.description,`description`,`text`),ha_mode:n[`ha-mode`],location:{lat:p(n[`location-lat`],`location-lat`,`text`),lon:p(n[`location-lon`],`location-lon`,`text`)},name:p(n.name,`name`,`text`),secondary_connector_id:p(n[`secondary-connector-id`],`secondary-connector-id`,`text`)}):s(n.body)});return}let r=await o(n),a=n.local?m:await i(r);if(n.accountId=a,n.body){let e=s(n.body);u(await f(`Creating`,async()=>r.magicTransit.sites.create({...e,account_id:a})),{successLabel:`Created`});return}n.name===void 0&&(n.name=await t(`name`,`The name of the site.`));let c=l({connector_id:p(n[`connector-id`],`connector-id`,`text`),description:p(n.description,`description`,`text`),ha_mode:n[`ha-mode`],location:{lat:p(n[`location-lat`],`location-lat`,`text`),lon:p(n[`location-lon`],`location-lon`,`text`)},name:p(n.name,`name`,`text`),secondary_connector_id:p(n[`secondary-connector-id`],`secondary-connector-id`,`text`)});u(await f(`Creating`,async()=>r.magicTransit.sites.create({...c,account_id:a})),{successLabel:`Created`})}};function Ti(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 Ei={command:`delete <site-id>`,describe:`Remove a specific Site.`,builder:Ti,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit sites delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}`,pathParams:{"site-id":String(t[`site-id`]??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
87
+ `);return}u(await f(`Deleting`,async()=>n.magicTransit.sites.delete({account_id:a,site_id:t[`site-id`]})),{successLabel:`Deleted`})}};function Di(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 Oi={command:`edit <site-id>`,describe:`Patch a specific Site.`,builder:Di,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit sites edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}`,pathParams:{"site-id":String(t[`site-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({connector_id:p(t[`connector-id`],`connector-id`,`text`),description:p(t.description,`description`,`text`),location:{lat:p(t[`location-lat`],`location-lat`,`text`),lon:p(t[`location-lon`],`location-lon`,`text`)},name:p(t.name,`name`,`text`),secondary_connector_id:p(t[`secondary-connector-id`],`secondary-connector-id`,`text`)}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Updating`,async()=>n.magicTransit.sites.edit({body:e,account_id:r,site_id:t[`site-id`]})),{successLabel:`Updated`});return}let a=l({connector_id:p(t[`connector-id`],`connector-id`,`text`),description:p(t.description,`description`,`text`),location:{lat:p(t[`location-lat`],`location-lat`,`text`),lon:p(t[`location-lon`],`location-lon`,`text`)},name:p(t.name,`name`,`text`),secondary_connector_id:p(t[`secondary-connector-id`],`secondary-connector-id`,`text`)});u(await f(`Updating`,async()=>n.magicTransit.sites.edit({body:a,account_id:r,site_id:t[`site-id`]})),{successLabel:`Updated`})}};function ki(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 Ai={command:`get <site-id>`,describe:`Get a specific Site.`,builder:ki,handler:async t=>{let n={};if(t[`x-magic-new-hc-target`]!==void 0&&(n[`x-magic-new-hc-target`]=String(t[`x-magic-new-hc-target`])),t.dryRun){d({command:`cf magic-transit sites get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}`,pathParams:{"site-id":String(t[`site-id`]??``)},bodyKind:`none`});return}let r=await o(t),s=t.local?m:await i(r);t.accountId=s,u(await f(`Loading`,async()=>a(r,`GET`,`/accounts/${s}/magic/sites/${encodeURIComponent(String(t[`site-id`]))}`,{headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Loaded`})}};function ji(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 Mi={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:ji,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit sites lans create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}/lans`,pathParams:{"site-id":String(t[`site-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({bond_id:t[`bond-id`],ha_link:t[`ha-link`],is_breakout:t[`is-breakout`],is_prioritized:t[`is-prioritized`],name:p(t.name,`name`,`text`),nat:{static_prefix:p(t[`nat-static-prefix`],`nat-static-prefix`,`text`)},physport:t.physport,static_addressing:{address:p(t[`static-addressing-address`],`static-addressing-address`,`text`),dhcp_relay:{server_addresses:t[`static-addressing-dhcp-relay-server-addresses`]},dhcp_server:{dhcp_pool_end:p(t[`static-addressing-dhcp-server-dhcp-pool-end`],`static-addressing-dhcp-server-dhcp-pool-end`,`text`),dhcp_pool_start:p(t[`static-addressing-dhcp-server-dhcp-pool-start`],`static-addressing-dhcp-server-dhcp-pool-start`,`text`),dns_server:p(t[`static-addressing-dhcp-server-dns-server`],`static-addressing-dhcp-server-dns-server`,`text`),dns_servers:t[`static-addressing-dhcp-server-dns-servers`]},secondary_address:p(t[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`),virtual_address:p(t[`static-addressing-virtual-address`],`static-addressing-virtual-address`,`text`)},vlan_tag:t[`vlan-tag`]}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Creating`,async()=>n.magicTransit.sites.lans.create({...e,account_id:r,site_id:t[`site-id`]})),{successLabel:`Created`});return}let a=l({bond_id:t[`bond-id`],ha_link:t[`ha-link`],is_breakout:t[`is-breakout`],is_prioritized:t[`is-prioritized`],name:p(t.name,`name`,`text`),nat:{static_prefix:p(t[`nat-static-prefix`],`nat-static-prefix`,`text`)},physport:t.physport,static_addressing:{address:p(t[`static-addressing-address`],`static-addressing-address`,`text`),dhcp_relay:{server_addresses:t[`static-addressing-dhcp-relay-server-addresses`]},dhcp_server:{dhcp_pool_end:p(t[`static-addressing-dhcp-server-dhcp-pool-end`],`static-addressing-dhcp-server-dhcp-pool-end`,`text`),dhcp_pool_start:p(t[`static-addressing-dhcp-server-dhcp-pool-start`],`static-addressing-dhcp-server-dhcp-pool-start`,`text`),dns_server:p(t[`static-addressing-dhcp-server-dns-server`],`static-addressing-dhcp-server-dns-server`,`text`),dns_servers:t[`static-addressing-dhcp-server-dns-servers`]},secondary_address:p(t[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`),virtual_address:p(t[`static-addressing-virtual-address`],`static-addressing-virtual-address`,`text`)},vlan_tag:t[`vlan-tag`]});u(await f(`Creating`,async()=>n.magicTransit.sites.lans.create({...a,account_id:r,site_id:t[`site-id`]})),{successLabel:`Created`})}};function Ni(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 Pi={command:`delete <lan-id>`,describe:`Remove a specific Site LAN.`,builder:Ni,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit sites lans delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}/lans/${t[`lan-id`]==null?`<lan-id>`:encodeURIComponent(String(t[`lan-id`]))}`,pathParams:{"site-id":String(t[`site-id`]??``),"lan-id":String(t[`lan-id`]??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
88
+ `);return}u(await f(`Deleting`,async()=>n.magicTransit.sites.lans.delete({account_id:a,site_id:t[`site-id`],lan_id:t[`lan-id`]})),{successLabel:`Deleted`})}};function Fi(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 Ii={command:`edit <lan-id>`,describe:`Patch a specific Site LAN.`,builder:Fi,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit sites lans edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}/lans/${t[`lan-id`]==null?`<lan-id>`:encodeURIComponent(String(t[`lan-id`]))}`,pathParams:{"site-id":String(t[`site-id`]??``),"lan-id":String(t[`lan-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({bond_id:t[`bond-id`],is_breakout:t[`is-breakout`],is_prioritized:t[`is-prioritized`],name:p(t.name,`name`,`text`),nat:{static_prefix:p(t[`nat-static-prefix`],`nat-static-prefix`,`text`)},physport:t.physport,static_addressing:{address:p(t[`static-addressing-address`],`static-addressing-address`,`text`),dhcp_relay:{server_addresses:t[`static-addressing-dhcp-relay-server-addresses`]},dhcp_server:{dhcp_pool_end:p(t[`static-addressing-dhcp-server-dhcp-pool-end`],`static-addressing-dhcp-server-dhcp-pool-end`,`text`),dhcp_pool_start:p(t[`static-addressing-dhcp-server-dhcp-pool-start`],`static-addressing-dhcp-server-dhcp-pool-start`,`text`),dns_server:p(t[`static-addressing-dhcp-server-dns-server`],`static-addressing-dhcp-server-dns-server`,`text`),dns_servers:t[`static-addressing-dhcp-server-dns-servers`]},secondary_address:p(t[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`),virtual_address:p(t[`static-addressing-virtual-address`],`static-addressing-virtual-address`,`text`)},vlan_tag:t[`vlan-tag`]}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Updating`,async()=>n.magicTransit.sites.lans.edit({body:e,account_id:r,site_id:t[`site-id`],lan_id:t[`lan-id`]})),{successLabel:`Updated`});return}let a=l({bond_id:t[`bond-id`],is_breakout:t[`is-breakout`],is_prioritized:t[`is-prioritized`],name:p(t.name,`name`,`text`),nat:{static_prefix:p(t[`nat-static-prefix`],`nat-static-prefix`,`text`)},physport:t.physport,static_addressing:{address:p(t[`static-addressing-address`],`static-addressing-address`,`text`),dhcp_relay:{server_addresses:t[`static-addressing-dhcp-relay-server-addresses`]},dhcp_server:{dhcp_pool_end:p(t[`static-addressing-dhcp-server-dhcp-pool-end`],`static-addressing-dhcp-server-dhcp-pool-end`,`text`),dhcp_pool_start:p(t[`static-addressing-dhcp-server-dhcp-pool-start`],`static-addressing-dhcp-server-dhcp-pool-start`,`text`),dns_server:p(t[`static-addressing-dhcp-server-dns-server`],`static-addressing-dhcp-server-dns-server`,`text`),dns_servers:t[`static-addressing-dhcp-server-dns-servers`]},secondary_address:p(t[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`),virtual_address:p(t[`static-addressing-virtual-address`],`static-addressing-virtual-address`,`text`)},vlan_tag:t[`vlan-tag`]});u(await f(`Updating`,async()=>n.magicTransit.sites.lans.edit({body:a,account_id:r,site_id:t[`site-id`],lan_id:t[`lan-id`]})),{successLabel:`Updated`})}};function Li(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 Ri={command:`get <lan-id>`,describe:`Get a specific Site LAN.`,builder:Li,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit sites lans get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}/lans/${t[`lan-id`]==null?`<lan-id>`:encodeURIComponent(String(t[`lan-id`]))}`,pathParams:{"site-id":String(t[`site-id`]??``),"lan-id":String(t[`lan-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,u(await f(`Loading`,async()=>n.magicTransit.sites.lans.get({account_id:r,site_id:t[`site-id`],lan_id:t[`lan-id`]})),{successLabel:`Loaded`})}};function zi(e){return e.option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Bi={command:`list`,describe:`Lists Site LANs associated with an account.`,builder:zi,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit sites lans list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}/lans`,pathParams:{"site-id":String(t[`site-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,u(await f(`Loading`,async()=>n.magicTransit.sites.lans.list({account_id:r,site_id:t[`site-id`]})),{successLabel:`Loaded`})}};function Vi(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 Hi={command:`update <lan-id>`,describe:`Update a specific Site LAN.`,builder:Vi,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit sites lans update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}/lans/${t[`lan-id`]==null?`<lan-id>`:encodeURIComponent(String(t[`lan-id`]))}`,pathParams:{"site-id":String(t[`site-id`]??``),"lan-id":String(t[`lan-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({bond_id:t[`bond-id`],is_breakout:t[`is-breakout`],is_prioritized:t[`is-prioritized`],name:p(t.name,`name`,`text`),nat:{static_prefix:p(t[`nat-static-prefix`],`nat-static-prefix`,`text`)},physport:t.physport,static_addressing:{address:p(t[`static-addressing-address`],`static-addressing-address`,`text`),dhcp_relay:{server_addresses:t[`static-addressing-dhcp-relay-server-addresses`]},dhcp_server:{dhcp_pool_end:p(t[`static-addressing-dhcp-server-dhcp-pool-end`],`static-addressing-dhcp-server-dhcp-pool-end`,`text`),dhcp_pool_start:p(t[`static-addressing-dhcp-server-dhcp-pool-start`],`static-addressing-dhcp-server-dhcp-pool-start`,`text`),dns_server:p(t[`static-addressing-dhcp-server-dns-server`],`static-addressing-dhcp-server-dns-server`,`text`),dns_servers:t[`static-addressing-dhcp-server-dns-servers`]},secondary_address:p(t[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`),virtual_address:p(t[`static-addressing-virtual-address`],`static-addressing-virtual-address`,`text`)},vlan_tag:t[`vlan-tag`]}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Updating`,async()=>n.magicTransit.sites.lans.update({body:e,account_id:r,site_id:t[`site-id`],lan_id:t[`lan-id`]})),{successLabel:`Updated`});return}let a=l({bond_id:t[`bond-id`],is_breakout:t[`is-breakout`],is_prioritized:t[`is-prioritized`],name:p(t.name,`name`,`text`),nat:{static_prefix:p(t[`nat-static-prefix`],`nat-static-prefix`,`text`)},physport:t.physport,static_addressing:{address:p(t[`static-addressing-address`],`static-addressing-address`,`text`),dhcp_relay:{server_addresses:t[`static-addressing-dhcp-relay-server-addresses`]},dhcp_server:{dhcp_pool_end:p(t[`static-addressing-dhcp-server-dhcp-pool-end`],`static-addressing-dhcp-server-dhcp-pool-end`,`text`),dhcp_pool_start:p(t[`static-addressing-dhcp-server-dhcp-pool-start`],`static-addressing-dhcp-server-dhcp-pool-start`,`text`),dns_server:p(t[`static-addressing-dhcp-server-dns-server`],`static-addressing-dhcp-server-dns-server`,`text`),dns_servers:t[`static-addressing-dhcp-server-dns-servers`]},secondary_address:p(t[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`),virtual_address:p(t[`static-addressing-virtual-address`],`static-addressing-virtual-address`,`text`)},vlan_tag:t[`vlan-tag`]});u(await f(`Updating`,async()=>n.magicTransit.sites.lans.update({body:a,account_id:r,site_id:t[`site-id`],lan_id:t[`lan-id`]})),{successLabel:`Updated`})}},Ui={command:`lans`,describe:`Operations for sites.lans`,builder:e=>e.command(Mi).command(Pi).command(Ii).command(Ri).command(Bi).command(Hi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Wi(e){return e.option(`connectorid`,{type:`string`,description:`Identifier`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Gi={command:`list`,describe:`Lists Sites associated with an account. Use connectorid query param to return sites where connectorid matches either site.ConnectorID or site.SecondaryConnectorID.`,builder:Wi,handler:async t=>{let n={connectorid:t.connectorid};if(t.dryRun){d({command:`cf magic-transit sites list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites`,pathParams:{},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?m:await i(r);t.accountId=a,u(await f(`Loading`,async()=>r.magicTransit.sites.list({account_id:a,...n})),{successLabel:`Loaded`})}};function Ki(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 qi={command:`create <site-id>`,describe:`Creates a NetFlow configuration for a site.`,builder:Ki,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit sites netflow-config create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}/netflow_config`,pathParams:{"site-id":String(t[`site-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({active_timeout:t[`active-timeout`],collector_ip:p(t[`collector-ip`],`collector-ip`,`text`),collector_port:t[`collector-port`],inactive_timeout:t[`inactive-timeout`],sampling_rate:t[`sampling-rate`]}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Creating`,async()=>n.magicTransit.sites.netflowConfig.create({body:e,account_id:r,site_id:t[`site-id`]})),{successLabel:`Created`});return}let a=l({active_timeout:t[`active-timeout`],collector_ip:p(t[`collector-ip`],`collector-ip`,`text`),collector_port:t[`collector-port`],inactive_timeout:t[`inactive-timeout`],sampling_rate:t[`sampling-rate`]});u(await f(`Creating`,async()=>n.magicTransit.sites.netflowConfig.create({body:a,account_id:r,site_id:t[`site-id`]})),{successLabel:`Created`})}};function Ji(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 Yi={command:`delete <site-id>`,describe:`Remove NetFlow configuration for a site.`,builder:Ji,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit sites netflow-config delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}/netflow_config`,pathParams:{"site-id":String(t[`site-id`]??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
89
+ `);return}u(await f(`Deleting`,async()=>n.magicTransit.sites.netflowConfig.delete({account_id:a,site_id:t[`site-id`]})),{successLabel:`Deleted`})}};function Xi(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 Zi={command:`edit <site-id>`,describe:`Updates NetFlow configuration for a site.`,builder:Xi,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit sites netflow-config edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}/netflow_config`,pathParams:{"site-id":String(t[`site-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({active_timeout:t[`active-timeout`],collector_ip:p(t[`collector-ip`],`collector-ip`,`text`),collector_port:t[`collector-port`],inactive_timeout:t[`inactive-timeout`],sampling_rate:t[`sampling-rate`]}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Updating`,async()=>n.magicTransit.sites.netflowConfig.edit({body:e,account_id:r,site_id:t[`site-id`]})),{successLabel:`Updated`});return}let a=l({active_timeout:t[`active-timeout`],collector_ip:p(t[`collector-ip`],`collector-ip`,`text`),collector_port:t[`collector-port`],inactive_timeout:t[`inactive-timeout`],sampling_rate:t[`sampling-rate`]});u(await f(`Updating`,async()=>n.magicTransit.sites.netflowConfig.edit({body:a,account_id:r,site_id:t[`site-id`]})),{successLabel:`Updated`})}};function Qi(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 $i={command:`get <site-id>`,describe:`Get NetFlow configuration for a site.`,builder:Qi,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit sites netflow-config get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}/netflow_config`,pathParams:{"site-id":String(t[`site-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,u(await f(`Loading`,async()=>n.magicTransit.sites.netflowConfig.get({account_id:r,site_id:t[`site-id`]})),{successLabel:`Loaded`})}};function ea(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 ta={command:`update <site-id>`,describe:`Updates NetFlow configuration for a site (partial update).`,builder:ea,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit sites netflow-config update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}/netflow_config`,pathParams:{"site-id":String(t[`site-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({active_timeout:t[`active-timeout`],collector_ip:p(t[`collector-ip`],`collector-ip`,`text`),collector_port:t[`collector-port`],inactive_timeout:t[`inactive-timeout`],sampling_rate:t[`sampling-rate`]}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Updating`,async()=>n.magicTransit.sites.netflowConfig.update({body:e,account_id:r,site_id:t[`site-id`]})),{successLabel:`Updated`});return}let a=l({active_timeout:t[`active-timeout`],collector_ip:p(t[`collector-ip`],`collector-ip`,`text`),collector_port:t[`collector-port`],inactive_timeout:t[`inactive-timeout`],sampling_rate:t[`sampling-rate`]});u(await f(`Updating`,async()=>n.magicTransit.sites.netflowConfig.update({body:a,account_id:r,site_id:t[`site-id`]})),{successLabel:`Updated`})}},na={command:`netflow-config`,describe:`Operations for sites.netflow-config`,builder:e=>e.command(qi).command(Yi).command(Zi).command($i).command(ta).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ra(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 ia={command:`update <site-id>`,describe:`Update a specific Site.`,builder:ra,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit sites update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}`,pathParams:{"site-id":String(t[`site-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({connector_id:p(t[`connector-id`],`connector-id`,`text`),description:p(t.description,`description`,`text`),location:{lat:p(t[`location-lat`],`location-lat`,`text`),lon:p(t[`location-lon`],`location-lon`,`text`)},name:p(t.name,`name`,`text`),secondary_connector_id:p(t[`secondary-connector-id`],`secondary-connector-id`,`text`)}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Updating`,async()=>n.magicTransit.sites.update({body:e,account_id:r,site_id:t[`site-id`]})),{successLabel:`Updated`});return}let a=l({connector_id:p(t[`connector-id`],`connector-id`,`text`),description:p(t.description,`description`,`text`),location:{lat:p(t[`location-lat`],`location-lat`,`text`),lon:p(t[`location-lon`],`location-lon`,`text`)},name:p(t.name,`name`,`text`),secondary_connector_id:p(t[`secondary-connector-id`],`secondary-connector-id`,`text`)});u(await f(`Updating`,async()=>n.magicTransit.sites.update({body:a,account_id:r,site_id:t[`site-id`]})),{successLabel:`Updated`})}};function aa(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 oa={command:`create <site-id>`,describe:`Creates a new Site WAN.`,builder:aa,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit sites wans create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}/wans`,pathParams:{"site-id":String(t[`site-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({name:p(t.name,`name`,`text`),physport:t.physport,priority:t.priority,static_addressing:{address:p(t[`static-addressing-address`],`static-addressing-address`,`text`),gateway_address:p(t[`static-addressing-gateway-address`],`static-addressing-gateway-address`,`text`),secondary_address:p(t[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`)},vlan_tag:t[`vlan-tag`]}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Creating`,async()=>n.magicTransit.sites.wans.create({...e,account_id:r,site_id:t[`site-id`]})),{successLabel:`Created`});return}if(t.physport===void 0)throw Error(`--physport is required (or pass --body with this field set).`);let a=l({name:p(t.name,`name`,`text`),physport:t.physport,priority:t.priority,static_addressing:{address:p(t[`static-addressing-address`],`static-addressing-address`,`text`),gateway_address:p(t[`static-addressing-gateway-address`],`static-addressing-gateway-address`,`text`),secondary_address:p(t[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`)},vlan_tag:t[`vlan-tag`]});u(await f(`Creating`,async()=>n.magicTransit.sites.wans.create({...a,account_id:r,site_id:t[`site-id`]})),{successLabel:`Created`})}};function sa(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 ca={command:`delete <wan-id>`,describe:`Remove a specific Site WAN.`,builder:sa,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit sites wans delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}/wans/${t[`wan-id`]==null?`<wan-id>`:encodeURIComponent(String(t[`wan-id`]))}`,pathParams:{"site-id":String(t[`site-id`]??``),"wan-id":String(t[`wan-id`]??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?m:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
90
+ `);return}u(await f(`Deleting`,async()=>n.magicTransit.sites.wans.delete({account_id:a,site_id:t[`site-id`],wan_id:t[`wan-id`]})),{successLabel:`Deleted`})}};function la(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 ua={command:`edit <wan-id>`,describe:`Patch a specific Site WAN.`,builder:la,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit sites wans edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}/wans/${t[`wan-id`]==null?`<wan-id>`:encodeURIComponent(String(t[`wan-id`]))}`,pathParams:{"site-id":String(t[`site-id`]??``),"wan-id":String(t[`wan-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({name:p(t.name,`name`,`text`),physport:t.physport,priority:t.priority,static_addressing:{address:p(t[`static-addressing-address`],`static-addressing-address`,`text`),gateway_address:p(t[`static-addressing-gateway-address`],`static-addressing-gateway-address`,`text`),secondary_address:p(t[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`)},vlan_tag:t[`vlan-tag`]}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Updating`,async()=>n.magicTransit.sites.wans.edit({body:e,account_id:r,site_id:t[`site-id`],wan_id:t[`wan-id`]})),{successLabel:`Updated`});return}let a=l({name:p(t.name,`name`,`text`),physport:t.physport,priority:t.priority,static_addressing:{address:p(t[`static-addressing-address`],`static-addressing-address`,`text`),gateway_address:p(t[`static-addressing-gateway-address`],`static-addressing-gateway-address`,`text`),secondary_address:p(t[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`)},vlan_tag:t[`vlan-tag`]});u(await f(`Updating`,async()=>n.magicTransit.sites.wans.edit({body:a,account_id:r,site_id:t[`site-id`],wan_id:t[`wan-id`]})),{successLabel:`Updated`})}};function da(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 fa={command:`get <wan-id>`,describe:`Get a specific Site WAN.`,builder:da,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit sites wans get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}/wans/${t[`wan-id`]==null?`<wan-id>`:encodeURIComponent(String(t[`wan-id`]))}`,pathParams:{"site-id":String(t[`site-id`]??``),"wan-id":String(t[`wan-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,u(await f(`Loading`,async()=>n.magicTransit.sites.wans.get({account_id:r,site_id:t[`site-id`],wan_id:t[`wan-id`]})),{successLabel:`Loaded`})}};function pa(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 ma={command:`list`,describe:`Lists Site WANs associated with an account.`,builder:pa,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit sites wans list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}/wans`,pathParams:{"site-id":String(t[`site-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,u(await f(`Loading`,async()=>n.magicTransit.sites.wans.list({account_id:r,site_id:t[`site-id`]})),{successLabel:`Loaded`})}};function ha(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 ga={command:`update <wan-id>`,describe:`Update a specific Site WAN.`,builder:ha,handler:async t=>{if(t.dryRun){d({command:`cf magic-transit sites wans update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/sites/${t[`site-id`]==null?`<site-id>`:encodeURIComponent(String(t[`site-id`]))}/wans/${t[`wan-id`]==null?`<wan-id>`:encodeURIComponent(String(t[`wan-id`]))}`,pathParams:{"site-id":String(t[`site-id`]??``),"wan-id":String(t[`wan-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({name:p(t.name,`name`,`text`),physport:t.physport,priority:t.priority,static_addressing:{address:p(t[`static-addressing-address`],`static-addressing-address`,`text`),gateway_address:p(t[`static-addressing-gateway-address`],`static-addressing-gateway-address`,`text`),secondary_address:p(t[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`)},vlan_tag:t[`vlan-tag`]}):s(t.body)});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.body){let e=s(t.body);u(await f(`Updating`,async()=>n.magicTransit.sites.wans.update({body:e,account_id:r,site_id:t[`site-id`],wan_id:t[`wan-id`]})),{successLabel:`Updated`});return}let a=l({name:p(t.name,`name`,`text`),physport:t.physport,priority:t.priority,static_addressing:{address:p(t[`static-addressing-address`],`static-addressing-address`,`text`),gateway_address:p(t[`static-addressing-gateway-address`],`static-addressing-gateway-address`,`text`),secondary_address:p(t[`static-addressing-secondary-address`],`static-addressing-secondary-address`,`text`)},vlan_tag:t[`vlan-tag`]});u(await f(`Updating`,async()=>n.magicTransit.sites.wans.update({body:a,account_id:r,site_id:t[`site-id`],wan_id:t[`wan-id`]})),{successLabel:`Updated`})}},_a={command:`wans`,describe:`Operations for sites.wans`,builder:e=>e.command(oa).command(ca).command(ua).command(fa).command(ma).command(ga).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},va={command:`sites`,describe:`Operations for sites`,builder:e=>e.command(wi).command(Ei).command(Oi).command(Ai).command(Gi).command(ia).command(di).command(Si).command(Ui).command(na).command(_a).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ya={command:`magic-transit`,describe:`DDoS-protected network transit — GRE/IPsec tunnels, static routes, Magic WAN sites, connectors, and packet captures`,builder:e=>e.command(F).command(Vt).command(Qt).command(un).command(hn).command(wn).command(Hn).command(tr).command(gr).command(Lr).command(Qr).command(va).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{ya as default};