cf 0.3.0 → 0.4.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 (171) hide show
  1. package/dist/_meta/agent-context.json +26 -21
  2. package/dist/_meta/commands.json +7696 -18100
  3. package/dist/_meta/schemas.json +6411 -13925
  4. package/dist/{abuse-reports-dMIfUJ8v.mjs → abuse-reports-Dy76QPNP.mjs} +1 -1
  5. package/dist/{accounts-Kx1epdA1.mjs → accounts-CjtZ8x1z.mjs} +2 -2
  6. package/dist/{acm-Utu252kC.mjs → acm-C2lYIWs1.mjs} +1 -1
  7. package/dist/{addressing-CBq7Z7Vq.mjs → addressing-CHFK6uxW.mjs} +1 -1
  8. package/dist/{agent-context-BGTU299M.mjs → agent-context-CgGCT0xU.mjs} +1 -1
  9. package/dist/{ai-DOOKLPkG.mjs → ai-DS3i-I1a.mjs} +1 -1
  10. package/dist/{ai-gateway-Cj1T3avF.mjs → ai-gateway-RIsegO2x.mjs} +1 -1
  11. package/dist/ai-search-Dcj4BauG.mjs +7 -0
  12. package/dist/{ai_gateway-C3fH22C0.mjs → ai_gateway-w7YwfcPE.mjs} +1 -1
  13. package/dist/{alerting-CqmEIaKn.mjs → alerting-Bk85NNf5.mjs} +1 -1
  14. package/dist/{analytics-Dv-X8x7D.mjs → analytics-CkhhhZWZ.mjs} +1 -1
  15. package/dist/{analytics_engine-DdXVR8z2.mjs → analytics_engine-B7qgDJCA.mjs} +1 -1
  16. package/dist/{api-gateway-CNv0IHTU.mjs → api-gateway-CWdR4Ne7.mjs} +1 -1
  17. package/dist/{argo-CX_A4kcn.mjs → argo-DnJRVnGX.mjs} +1 -1
  18. package/dist/artifacts-BVWKiJUl.mjs +4 -0
  19. package/dist/{audit-logs-BfBf3oo-.mjs → audit-logs-DjTstbzL.mjs} +1 -1
  20. package/dist/auth-BqDOIrKX.mjs +150 -0
  21. package/dist/auth-DKkSwnxh.mjs +5 -0
  22. package/dist/billing-3rEqF83h.mjs +2 -0
  23. package/dist/{bot-management-CFvtVx62.mjs → bot-management-CJxD1pqi.mjs} +1 -1
  24. package/dist/{botnet-feed-B-M4Yu0W.mjs → botnet-feed-MG91D7BR.mjs} +1 -1
  25. package/dist/{brand-protection-D05Eg-_6.mjs → brand-protection-CK7gJi06.mjs} +1 -1
  26. package/dist/browser-rendering-Rae0AUt0.mjs +4 -0
  27. package/dist/{build-DYkGW4dh.mjs → build-BE4o4imx.mjs} +131 -131
  28. package/dist/{cache-DsoW6Xwv.mjs → cache-B7pRbpTy.mjs} +1 -1
  29. package/dist/{calls-CZbO7TyR.mjs → calls-DXRWsZ8n.mjs} +3 -3
  30. package/dist/{certificate-authorities-D2yr7_3t.mjs → certificate-authorities-BR3gXBLs.mjs} +1 -1
  31. package/dist/chunk-6IEM75FG-U3L9fKgi.mjs +2 -0
  32. package/dist/{client-certificates-MJcDsTId.mjs → client-certificates-B0ebLJdk.mjs} +1 -1
  33. package/dist/{cloud-connector-DWOrN2eM.mjs → cloud-connector-BOjaggJk.mjs} +1 -1
  34. package/dist/{cloudforce-one-2Bhz8YdW.mjs → cloudforce-one-B6HYfk5Z.mjs} +1 -1
  35. package/dist/{completions-BwRpZQVn.mjs → completions-D_9WsLG7.mjs} +1 -1
  36. package/dist/config-7CBz8Xm0.mjs +2 -0
  37. package/dist/{connectivity-BX8C7tvK.mjs → connectivity-welFvZ7X.mjs} +1 -1
  38. package/dist/connector-interrupts-DTV3F-50.mjs +2 -0
  39. package/dist/connector-telemetry-events-kDqb_AGm.mjs +2 -0
  40. package/dist/connector-telemetry-snapshots-DC-wD75E.mjs +2 -0
  41. package/dist/connectors-3vjrdFLB.mjs +3 -0
  42. package/dist/content-scanning-CnW2A0pv.mjs +4 -0
  43. package/dist/{context-DGlHRGWM.mjs → context-CONbNKO-.mjs} +1 -1
  44. package/dist/{custom-certificates-aAiEguR7.mjs → custom-certificates-CnYh6Yi-.mjs} +1 -1
  45. package/dist/{custom-hostnames-AG5yBHIi.mjs → custom-hostnames-C2upqZso.mjs} +1 -1
  46. package/dist/{custom-nameservers-D1DtlRue.mjs → custom-nameservers-BGkAD_PZ.mjs} +1 -1
  47. package/dist/{custom-pages-DQCi2plU.mjs → custom-pages-5fCSP8in.mjs} +1 -1
  48. package/dist/{d1-DbnYhw45.mjs → d1-CyiRbZZn.mjs} +1 -1
  49. package/dist/data-security-Casx4OS_.mjs +6 -0
  50. package/dist/{dcv-delegation-CHspSzTI.mjs → dcv-delegation-DVYO10oA.mjs} +1 -1
  51. package/dist/{deploy-CQial3kN.mjs → deploy-KBRFIatG.mjs} +1 -1
  52. package/dist/{dev-B38LfCTl.mjs → dev-pPazzZvt.mjs} +1 -1
  53. package/dist/{diagnostics-BJQGjVJn.mjs → diagnostics-BqYDoDfw.mjs} +1 -1
  54. package/dist/{dispatch-namespaces-DmHvoBOg.mjs → dispatch-namespaces-Cz2rajnP.mjs} +1 -1
  55. package/dist/{dist-AIcZFk0U.mjs → dist-DA54ZQu0.mjs} +7 -7
  56. package/dist/dist-DpDjsWWn.mjs +306 -0
  57. package/dist/{dns-VMhQSr5n.mjs → dns-62t95Xif.mjs} +1 -1
  58. package/dist/{dns-firewall-B4DVXFBQ.mjs → dns-firewall-Coy8d47t.mjs} +1 -1
  59. package/dist/{durable-objects-CTboySEo.mjs → durable-objects-BSuRERkw.mjs} +1 -1
  60. package/dist/{email-routing-tIR2SFu-.mjs → email-routing-BDUYYeV3.mjs} +1 -1
  61. package/dist/{email-security-Ca1id3rZ.mjs → email-security-ChHA6eqQ.mjs} +1 -1
  62. package/dist/{email-sending-DwWKc5jC.mjs → email-sending-CVrRqn6S.mjs} +1 -1
  63. package/dist/{filters-A4dg_a68.mjs → filters-qJpU9uAS.mjs} +1 -1
  64. package/dist/{firewall-DWPQgYd9.mjs → firewall-C3DDwfwh.mjs} +1 -1
  65. package/dist/{fraud-BMkSsJGU.mjs → fraud-DY3YXFVf.mjs} +1 -1
  66. package/dist/{google-tag-gateway-BGD49nRC.mjs → google-tag-gateway-B00MHDfB.mjs} +1 -1
  67. package/dist/{healthchecks-CtIfrFql.mjs → healthchecks-Drvb79v0.mjs} +1 -1
  68. package/dist/{hostnames-BiomxukN.mjs → hostnames-BdAQo1Mr.mjs} +1 -1
  69. package/dist/{hyperdrive-Da104VaQ.mjs → hyperdrive-99OJV9nl.mjs} +1 -1
  70. package/dist/{iam-BIGKo0WW.mjs → iam-BRbpg3lN.mjs} +1 -1
  71. package/dist/images-D1jI3r3O.mjs +7 -0
  72. package/dist/index.mjs +1 -1
  73. package/dist/{intel-CY6_79v8.mjs → intel-C3ajLpXd.mjs} +1 -1
  74. package/dist/{ips-K4bzaGqd.mjs → ips-B6JETVOY.mjs} +1 -1
  75. package/dist/{keyless-certificates-CZC-L8gM.mjs → keyless-certificates-C4MZ4xnf.mjs} +1 -1
  76. package/dist/{kv-8o27w_pY.mjs → kv-CSWoD9ks.mjs} +1 -1
  77. package/dist/{leaked-credential-checks-qLzRyu85.mjs → leaked-credential-checks-Dgs2oKm9.mjs} +2 -2
  78. package/dist/{load-balancers-DtG8nj25.mjs → load-balancers-Du1tNuUt.mjs} +1 -1
  79. package/dist/{logpush-4L0njy1d.mjs → logpush-SuJyO-uX.mjs} +1 -1
  80. package/dist/{logs-B_Yp95hv.mjs → logs-DcDNRPRl.mjs} +1 -1
  81. package/dist/{magic-cloud-networking-CSOM3EM-.mjs → magic-cloud-networking-D-T0RCvi.mjs} +1 -1
  82. package/dist/{magic-network-monitoring-BnwvM4-I.mjs → magic-network-monitoring-CqtvOePQ.mjs} +1 -1
  83. package/dist/{magic-transit-CXDyvhxq.mjs → magic-transit-BTbkhBtF.mjs} +32 -33
  84. package/dist/{managed-transforms-D15yVbZx.mjs → managed-transforms-CfUBSz9p.mjs} +1 -1
  85. package/dist/{mtls-certificates-D8k0AXWK.mjs → mtls-certificates-Cf1O8c2E.mjs} +1 -1
  86. package/dist/{network-interconnects-rrr7red3.mjs → network-interconnects-DsiNytOU.mjs} +1 -1
  87. package/dist/{observability-DWvpqnQJ.mjs → observability-CLqZ7OSi.mjs} +1 -1
  88. package/dist/open-YWOUIZ5Y-BpqIuBsR.mjs +4 -0
  89. package/dist/{organizations-T77D50Sq.mjs → organizations-aRi1bhFC.mjs} +2 -2
  90. package/dist/{origin-ca-certificates-DXIvD8H5.mjs → origin-ca-certificates-BB4H89a_.mjs} +1 -1
  91. package/dist/{origin-post-quantum-encryption-C8oOczyV.mjs → origin-post-quantum-encryption-DurP3PXG.mjs} +1 -1
  92. package/dist/{origin-tls-client-auth-CaVW1Ztp.mjs → origin-tls-client-auth-CnQNy9-l.mjs} +1 -1
  93. package/dist/{output-BJFNwj7b.mjs → output-CUxZRM5A.mjs} +1 -1
  94. package/dist/{page-rules-CjZPTMQX.mjs → page-rules-CYqtPU1p.mjs} +1 -1
  95. package/dist/{page-shield-D5RRNJCY.mjs → page-shield-D8l9ZMUl.mjs} +1 -1
  96. package/dist/{pages-CWJtJnL0.mjs → pages-ChurJ2H7.mjs} +1 -1
  97. package/dist/{pipelines-B0L_7j9e.mjs → pipelines-CeyujvRf.mjs} +1 -1
  98. package/dist/{progress-CrCGTq7N.mjs → progress-Cent9Lsg.mjs} +1 -1
  99. package/dist/{queues-CN6DPhRR.mjs → queues-Rf_n11Cx.mjs} +1 -1
  100. package/dist/{r2-DQIcyRtA.mjs → r2-BtuTO3vQ.mjs} +1 -1
  101. package/dist/{r2-data-catalog-Bbo93TJx.mjs → r2-data-catalog-Debz38kv.mjs} +1 -1
  102. package/dist/radar-CzGM92uM.mjs +2 -0
  103. package/dist/{rate-limits-DcrQV6Ar.mjs → rate-limits-Bbk7HxP7.mjs} +1 -1
  104. package/dist/{raw-fetch-Dlccg0Tr.mjs → raw-fetch-DnbAMFBp.mjs} +1 -1
  105. package/dist/{realtime-kit-CaquuVOE.mjs → realtime-kit-CivLpkpg.mjs} +1 -1
  106. package/dist/{registrar-Ko-xZemf.mjs → registrar-8IeA5DKd.mjs} +1 -1
  107. package/dist/{request-tracers-DOW_reTJ.mjs → request-tracers-D1aH4NmL.mjs} +1 -1
  108. package/dist/{resource-sharing-D7TX0JV0.mjs → resource-sharing-B-Pcto7-.mjs} +3 -3
  109. package/dist/{resource-tagging-C3qtLzCz.mjs → resource-tagging-Bpb6Qq1M.mjs} +1 -1
  110. package/dist/{rules-BXRADHL5.mjs → rules-B10XWY10.mjs} +1 -1
  111. package/dist/{rulesets-CBgpeSvJ.mjs → rulesets-lYczEcJp.mjs} +1 -1
  112. package/dist/{rum-BjPptTUP.mjs → rum-B5GUKa4I.mjs} +3 -3
  113. package/dist/{schema-D16TgWBg.mjs → schema-hefO-tzo.mjs} +1 -1
  114. package/dist/{schema-validation-Dgv_opM3.mjs → schema-validation-DTq517Em.mjs} +1 -1
  115. package/dist/{scim-DdSEr4kZ.mjs → scim-BiLfOQ89.mjs} +1 -1
  116. package/dist/{secrets-store-7BfyvJLb.mjs → secrets-store-CBX0dvHL.mjs} +1 -1
  117. package/dist/{security-center-DAy6AKtT.mjs → security-center-AVpTOBK3.mjs} +1 -1
  118. package/dist/{security-txt-xAMb7K6Y.mjs → security-txt-DVlh8y9l.mjs} +1 -1
  119. package/dist/{session-COHHdS7A.mjs → session-CsvPYFj8.mjs} +2 -2
  120. package/dist/shared-0bwWVDLo.mjs +2 -0
  121. package/dist/{smart-shield-TeWZFnH2.mjs → smart-shield-DblHIce0.mjs} +1 -1
  122. package/dist/{snippets-CCSsCXVs.mjs → snippets-DrpqSXYC.mjs} +1 -1
  123. package/dist/{spawn-DcppKGI5.mjs → spawn-DK7pott_.mjs} +1 -1
  124. package/dist/{spectrum-CTTZID8u.mjs → spectrum-CnrG0jIC.mjs} +2 -2
  125. package/dist/speed-BzRY3Xlh.mjs +4 -0
  126. package/dist/{src-BW6vfAwE.mjs → src-D9_Gq68b.mjs} +10 -10
  127. package/dist/{ssl-BWA2LdwC.mjs → ssl-Cp6tQkZH.mjs} +1 -1
  128. package/dist/stream-CGTRN4ZN.mjs +14 -0
  129. package/dist/{tenants-Bd7NGQ_m.mjs → tenants-o_M62Y1n.mjs} +1 -1
  130. package/dist/{token-validation-DAgtFOvs.mjs → token-validation-Ca5AGEns.mjs} +1 -1
  131. package/dist/{tools-DXQmfFuE.mjs → tools-DtNNmO6l.mjs} +1 -1
  132. package/dist/{turnstile-cfdaO4ca.mjs → turnstile-l7mo9BWL.mjs} +2 -2
  133. package/dist/{ui-D4KtlMh9.mjs → ui-B97lRnOv.mjs} +1 -1
  134. package/dist/{url-normalization-B5RN4nLD.mjs → url-normalization-D1CogSIG.mjs} +1 -1
  135. package/dist/{url-scanner-BrZ1L9OC.mjs → url-scanner-BnJHJqcz.mjs} +1 -1
  136. package/dist/{user-CAo-yCJA.mjs → user-CiyYZ69X.mjs} +2 -2
  137. package/dist/{vectorize-C7_oQlaI.mjs → vectorize-D3LgMLOn.mjs} +1 -1
  138. package/dist/{versions-CUwWJWmy.mjs → versions-B6E8WQyA.mjs} +1 -1
  139. package/dist/{waiting-rooms-Dln5ICg5.mjs → waiting-rooms-Bhy_nuV3.mjs} +1 -1
  140. package/dist/{web3-HQJRm38W.mjs → web3-DlHE0CZc.mjs} +1 -1
  141. package/dist/{workers-Dg7ddG2Q.mjs → workers-DRAkU6YR.mjs} +1 -1
  142. package/dist/{workers-builds-AVfx8IyL.mjs → workers-builds-BmNjiHDZ.mjs} +1 -1
  143. package/dist/{workflows-VquuSh2J.mjs → workflows-z6oapEJs.mjs} +1 -1
  144. package/dist/{zaraz-xYSWIV4P.mjs → zaraz-CyzfYOEU.mjs} +1 -1
  145. package/dist/{zero-trust-CP96wnSh.mjs → zero-trust-fyyIelWx.mjs} +44 -44
  146. package/dist/zero_trust-BAhlNkjo.mjs +3 -0
  147. package/dist/{zones-BSgmZ9WC.mjs → zones-MSULnDwW.mjs} +4 -4
  148. package/package.json +4 -4
  149. package/dist/ai-search-CQF_Sn7d.mjs +0 -7
  150. package/dist/auth-SyWhMmPu.mjs +0 -6
  151. package/dist/auth-ffdf9yR0.mjs +0 -135
  152. package/dist/autorag-BuGhGTeZ.mjs +0 -2
  153. package/dist/billing-PoG81XaQ.mjs +0 -2
  154. package/dist/browser-rendering-xu8F_Rrv.mjs +0 -4
  155. package/dist/config-DYzlVxcB.mjs +0 -2
  156. package/dist/content-scanning-r6uzMO1r.mjs +0 -4
  157. package/dist/data-security-D_EtYBfo.mjs +0 -6
  158. package/dist/dist-DNBSHor6.mjs +0 -301
  159. package/dist/images-BO8FbDAa.mjs +0 -5
  160. package/dist/radar-Bxb0WX8V.mjs +0 -2
  161. package/dist/shared-AGtpXwwL.mjs +0 -2
  162. package/dist/speed-CuzTE0AL.mjs +0 -4
  163. package/dist/stream-GFsIZ-pP.mjs +0 -14
  164. /package/dist/{body-parser-DKa8Ipg1.mjs → body-parser-CBpeIUns.mjs} +0 -0
  165. /package/dist/{cli-types-CRIDdDw3.mjs → cli-types-CMNMD1V7.mjs} +0 -0
  166. /package/dist/{input-validation-zEO81MWN.mjs → input-validation-CTqtyiY9.mjs} +0 -0
  167. /package/dist/{lib-Eu1wXxuh.mjs → lib-B6xvCJjc.mjs} +0 -0
  168. /package/dist/{local-VJaJ3BZ1.mjs → local-D8bhHUMK.mjs} +0 -0
  169. /package/dist/{metadata-5VwHPW6C.mjs → metadata-jh2EIan8.mjs} +0 -0
  170. /package/dist/{resolve-4-OSeHlK.mjs → resolve-D1mG0REg.mjs} +0 -0
  171. /package/dist/{theme-BklJDrb2.mjs → theme-CFHr0Dh9.mjs} +0 -0
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{C as e,D as t,S as n,T as r,_ as i,i as a,n as o}from"./auth-ffdf9yR0.mjs";import{n as s,t as c}from"./body-parser-DKa8Ipg1.mjs";import{t as l}from"./output-BJFNwj7b.mjs";import{n as u,t as d}from"./progress-CrCGTq7N.mjs";import{n as f,t as p}from"./input-validation-zEO81MWN.mjs";import{t as m}from"./local-VJaJ3BZ1.mjs";import{t as h}from"./cli-types-CRIDdDw3.mjs";function ee(e){return e.option(`allow-out-of-region-access`,{type:`boolean`,description:`Allow out of region access`}).option(`regions`,{type:`string`,description:`Name of the region.`}).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 g={command:`create`,describe:`Updates CMB config.`,builder:ee,handler:async t=>{if(t.dryRun){u({command:`cf logs control cmb config create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/logs/control/cmb/config`,pathParams:{},bodyKind:`json`,body:t.body===void 0?c({allow_out_of_region_access:t[`allow-out-of-region-access`],regions:f(t.regions,`regions`,`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);l(await d(`Creating`,async()=>n.logs.control.cmb.config.create({body:e,account_id:r})),{successLabel:`Created`});return}let a=c({allow_out_of_region_access:t[`allow-out-of-region-access`],regions:f(t.regions,`regions`,`text`)});l(await d(`Creating`,async()=>n.logs.control.cmb.config.create({body:a,account_id:r})),{successLabel:`Created`})}};function _(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const v={command:`delete`,describe:`Deletes CMB config.`,builder:_,handler:async t=>{if(t.dryRun){u({command:`cf logs control cmb config delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/logs/control/cmb/config`,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.
2
+ import{C as e,D as t,S as n,T as r,_ as i,i as a,n as o}from"./auth-BqDOIrKX.mjs";import{n as s,t as c}from"./body-parser-CBpeIUns.mjs";import{t as l}from"./output-CUxZRM5A.mjs";import{n as u,t as d}from"./progress-Cent9Lsg.mjs";import{n as f,t as p}from"./input-validation-CTqtyiY9.mjs";import{t as m}from"./local-D8bhHUMK.mjs";import{t as h}from"./cli-types-CMNMD1V7.mjs";function ee(e){return e.option(`allow-out-of-region-access`,{type:`boolean`,description:`Allow out of region access`}).option(`regions`,{type:`string`,description:`Name of the region.`}).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 g={command:`create`,describe:`Updates CMB config.`,builder:ee,handler:async t=>{if(t.dryRun){u({command:`cf logs control cmb config create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/logs/control/cmb/config`,pathParams:{},bodyKind:`json`,body:t.body===void 0?c({allow_out_of_region_access:t[`allow-out-of-region-access`],regions:f(t.regions,`regions`,`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);l(await d(`Creating`,async()=>n.logs.control.cmb.config.create({body:e,account_id:r})),{successLabel:`Created`});return}let a=c({allow_out_of_region_access:t[`allow-out-of-region-access`],regions:f(t.regions,`regions`,`text`)});l(await d(`Creating`,async()=>n.logs.control.cmb.config.create({body:a,account_id:r})),{successLabel:`Created`})}};function _(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const v={command:`delete`,describe:`Deletes CMB config.`,builder:_,handler:async t=>{if(t.dryRun){u({command:`cf logs control cmb config delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/logs/control/cmb/config`,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
3
  `);return}l(await d(`Deleting`,async()=>n.logs.control.cmb.config.delete({account_id:a})),{successLabel:`Deleted`})}};function y(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`get`,describe:`Gets CMB config.`,builder:y,handler:async t=>{if(t.dryRun){u({command:`cf logs control cmb config get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/logs/control/cmb/config`,pathParams:{},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.logs.control.cmb.config.get({account_id:r})),{successLabel:`Loaded`})}},x={command:`config`,describe:`Log control operations`,builder:e=>e.command(g).command(v).command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},S={command:`cmb`,describe:`Operations for control.cmb`,builder:e=>e.command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function C(e){return e.option(`flag`,{type:`boolean`,description:`The log retention flag for Logpull API.`}).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 w={command:`create`,describe:`Updates log retention flag for Logpull API.`,builder:C,handler:async e=>{if(e.dryRun){u({command:`cf logs control retention create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/logs/control/retention/flag`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({flag:e.flag}):s(e.body)});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=s(e.body);l(await d(`Creating`,async()=>t.logs.control.retention.create({body:n,zone_id:r})),{successLabel:`Created`});return}let i=c({flag:e.flag});l(await d(`Creating`,async()=>t.logs.control.retention.create({body:i,zone_id:r})),{successLabel:`Created`})}};function T(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`get`,describe:`Gets log retention flag for Logpull API.`,builder:T,handler:async e=>{if(e.dryRun){u({command:`cf logs control retention get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/logs/control/retention/flag`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>t.logs.control.retention.get({zone_id:r})),{successLabel:`Loaded`})}},D={command:`retention`,describe:`Log control operations`,builder:e=>e.command(w).command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},O={command:`control`,describe:`Operations for control`,builder:e=>e.command(S).command(D).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function k(e){return e.option(`start`,{type:`string`,description:`Start time in RFC3339 format.`,demandOption:!0}).option(`end`,{type:`string`,description:`End time in RFC3339 format.`,demandOption:!0}).option(`bucket`,{type:`string`,description:`R2 bucket name.`,demandOption:!0}).option(`prefix`,{type:`string`,description:`R2 bucket prefix logs are stored under.`}).option(`limit`,{type:`number`,description:`Maximum number of results to return.`}).option(`r2-access-key-id`,{type:`string`,description:`The R2-Access-Key-Id header`,demandOption:!0}).option(`r2-secret-access-key`,{type:`string`,description:`The R2-Secret-Access-Key header`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`get`,describe:`Lists R2 objects containing logs matching the provided query parameters.`,builder:k,handler:async t=>{let n={start:t.start,end:t.end,bucket:t.bucket,prefix:t.prefix,limit:t.limit},r={};if(t[`r2-access-key-id`]!==void 0&&(r[`R2-Access-Key-Id`]=String(t[`r2-access-key-id`])),t[`r2-secret-access-key`]!==void 0&&(r[`R2-Secret-Access-Key`]=String(t[`r2-secret-access-key`])),t.dryRun){u({command:`cf logs list get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/logs/list`,pathParams:{},query:n,bodyKind:`none`});return}let s=await o(t),c=t.local?m:await i(s);t.accountId=c,l(await d(`Loading`,async()=>a(s,`GET`,`/accounts/${c}/logs/list`,{query:n,headers:Object.keys(r).length>0?r:void 0})),{successLabel:`Loaded`})}},j={command:`list`,describe:`Operations for list`,builder:e=>e.command(A).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function M(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const N={command:`list`,describe:`Returns all dataset types that this account can create. Each entry includes the dataset schema and timestamp field. The schema shows all possible fields for a dataset. However, not all fields may be available for your account. When creating or updating a dataset, only fields available to your account can be enabled. If you request a field that is not available, you will receive an error.`,builder:M,handler:async t=>{if(t.dryRun){u({command:`cf logs log-explorer datasets accounts available list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/logs/explorer/datasets/available`,pathParams:{},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.logs.logExplorer.datasets.accounts.available.list({account_id:r})),{successLabel:`Loaded`})}},P={command:`available`,describe:`Operations for log-explorer.datasets.accounts.available`,builder:e=>e.command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function F(e){return e.option(`dataset`,{type:`string`,description:"Dataset type name to create (e.g. `http_requests`)."}).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:`create`,describe:"Create a new Log Explorer dataset for the account. Use the `/accounts/{account_id}/logs/explorer/datasets/available` endpoint to list dataset types you can create along with their available fields. The `fields` property is optional. If not specified, all available fields will be enabled. For zone-level datasets use the zone-scoped endpoint: POST /zones/{zone_id}/logs/explorer/datasets For dataset field definitions, see: https://developers.cloudflare.com/logs/logpush/logpush-job/datasets/",builder:F,handler:async n=>{if(n.dryRun){u({command:`cf logs log-explorer datasets accounts create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/logs/explorer/datasets`,pathParams:{},bodyKind:`json`,body:n.body===void 0?c({dataset:f(n.dataset,`dataset`,`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);l(await d(`Creating`,async()=>r.logs.logExplorer.datasets.accounts.create({body:e,account_id:a})),{successLabel:`Created`});return}n.dataset===void 0&&(n.dataset=await t(`dataset`,"Dataset type name to create (e.g. `http_requests`)."));let p=c({dataset:f(n.dataset,`dataset`,`text`)});l(await d(`Creating`,async()=>r.logs.logExplorer.datasets.accounts.create({body:p,account_id:a})),{successLabel:`Created`})}};function L(e){return e.positional(`dataset-id`,{type:`string`,description:`Log Explorer dataset ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const R={command:`get <dataset-id>`,describe:`Retrieve a single Log Explorer dataset by ID for the account.`,builder:L,handler:async t=>{if(t.dryRun){u({command:`cf logs log-explorer datasets accounts get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/logs/explorer/datasets/${t[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(t[`dataset-id`]))}`,pathParams:{"dataset-id":String(t[`dataset-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.logs.logExplorer.datasets.accounts.get({account_id:r,dataset_id:t[`dataset-id`]})),{successLabel:`Loaded`})}};function z(e){return e.option(`include-zones`,{type:`boolean`,description:`Set to true to include zone-scoped datasets belonging to this account.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const B={command:`list`,describe:"Returns all Log Explorer datasets configured for the account. Pass `include_zones=true` to also include zone-level datasets that belong to this account. List responses omit the `fields` property; use the single-dataset endpoint to retrieve field configuration.",builder:z,handler:async t=>{let n={include_zones:t[`include-zones`]};if(t.dryRun){u({command:`cf logs log-explorer datasets accounts list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/logs/explorer/datasets`,pathParams:{},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?m:await i(r);t.accountId=a,l(await d(`Loading`,async()=>r.logs.logExplorer.datasets.accounts.list({account_id:a,...n})),{successLabel:`Loaded`})}};function V(e){return e.positional(`dataset-id`,{type:`string`,description:`Log Explorer dataset ID.`,demandOption:!0}).option(`enabled`,{type:`boolean`,description:`Whether to enable or disable log ingest for this dataset.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const H={command:`update <dataset-id>`,describe:`Updates the enabled state and/or field configuration of an account dataset.`,builder:V,handler:async t=>{if(t.dryRun){u({command:`cf logs log-explorer datasets accounts update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/logs/explorer/datasets/${t[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(t[`dataset-id`]))}`,pathParams:{"dataset-id":String(t[`dataset-id`]??``)},bodyKind:`json`,body:t.body===void 0?c({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);l(await d(`Updating`,async()=>n.logs.logExplorer.datasets.accounts.update({body:e,account_id:r,dataset_id:t[`dataset-id`]})),{successLabel:`Updated`});return}if(t.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);let a=c({enabled:t.enabled});l(await d(`Updating`,async()=>n.logs.logExplorer.datasets.accounts.update({body:a,account_id:r,dataset_id:t[`dataset-id`]})),{successLabel:`Updated`})}},U={command:`accounts`,describe:`Operations for log-explorer.datasets.accounts`,builder:e=>e.command(I).command(R).command(B).command(H).command(P).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function te(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const W={command:`list`,describe:`Returns all dataset types that this zone can create. Each entry includes the dataset schema and timestamp field. The schema shows all possible fields for a dataset. However, not all fields may be available for your account. When creating or updating a dataset, only fields available to your account can be enabled. If you request a field that is not available, you will receive an error.`,builder:te,handler:async e=>{if(e.dryRun){u({command:`cf logs log-explorer datasets zones available list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/logs/explorer/datasets/available`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>t.logs.logExplorer.datasets.zones.available.list({zone_id:r})),{successLabel:`Loaded`})}},G={command:`available`,describe:`Operations for log-explorer.datasets.zones.available`,builder:e=>e.command(W).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function K(e){return e.option(`dataset`,{type:`string`,description:"Dataset type name to create (e.g. `http_requests`)."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const q={command:`create`,describe:"Create a new Log Explorer dataset for the zone. Use the `/zones/{zone_id}/logs/explorer/datasets/available` endpoint to list dataset types you can create along with their available fields. The `fields` property is optional. If not specified, all available fields will be enabled. For account-level datasets use the account-scoped endpoint: POST /accounts/{account_id}/logs/explorer/datasets For dataset field definitions, see: https://developers.cloudflare.com/logs/logpush/logpush-job/datasets/",builder:K,handler:async e=>{if(e.dryRun){u({command:`cf logs log-explorer datasets zones create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/logs/explorer/datasets`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({dataset:f(e.dataset,`dataset`,`text`)}):s(e.body)});return}let r=await o(e),i=await n({zone:e.zone},r,{quiet:e.quiet});if(e.zoneId=i,e.body){let t=s(e.body);l(await d(`Creating`,async()=>r.logs.logExplorer.datasets.zones.create({body:t,zone_id:i})),{successLabel:`Created`});return}e.dataset===void 0&&(e.dataset=await t(`dataset`,"Dataset type name to create (e.g. `http_requests`)."));let a=c({dataset:f(e.dataset,`dataset`,`text`)});l(await d(`Creating`,async()=>r.logs.logExplorer.datasets.zones.create({body:a,zone_id:i})),{successLabel:`Created`})}};function J(e){return e.positional(`dataset-id`,{type:`string`,description:`Log Explorer dataset ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Y={command:`get <dataset-id>`,describe:`Retrieve a single Log Explorer dataset by ID for the zone.`,builder:J,handler:async e=>{if(e.dryRun){u({command:`cf logs log-explorer datasets zones get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/logs/explorer/datasets/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"dataset-id":String(e[`dataset-id`]??``)},bodyKind:`none`});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>t.logs.logExplorer.datasets.zones.get({zone_id:r,dataset_id:e[`dataset-id`]})),{successLabel:`Loaded`})}};function X(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Z={command:`list`,describe:"Returns all Log Explorer datasets configured for the zone. List responses omit the `fields` property; use the single-dataset endpoint to retrieve field configuration.",builder:X,handler:async e=>{if(e.dryRun){u({command:`cf logs log-explorer datasets zones list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/logs/explorer/datasets`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>t.logs.logExplorer.datasets.zones.list({zone_id:r})),{successLabel:`Loaded`})}};function Q(e){return e.positional(`dataset-id`,{type:`string`,description:`Log Explorer dataset ID.`,demandOption:!0}).option(`enabled`,{type:`boolean`,description:`Whether to enable or disable log ingest for this dataset.`}).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 ne={command:`update <dataset-id>`,describe:`Updates the enabled state and/or field configuration of a zone dataset.`,builder:Q,handler:async e=>{if(e.dryRun){u({command:`cf logs log-explorer datasets zones update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/logs/explorer/datasets/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"dataset-id":String(e[`dataset-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({enabled:e.enabled}):s(e.body)});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=s(e.body);l(await d(`Updating`,async()=>t.logs.logExplorer.datasets.zones.update({body:n,zone_id:r,dataset_id:e[`dataset-id`]})),{successLabel:`Updated`});return}if(e.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);let i=c({enabled:e.enabled});l(await d(`Updating`,async()=>t.logs.logExplorer.datasets.zones.update({body:i,zone_id:r,dataset_id:e[`dataset-id`]})),{successLabel:`Updated`})}},re={command:`zones`,describe:`Operations for log-explorer.datasets.zones`,builder:e=>e.command(q).command(Y).command(Z).command(ne).command(G).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ie={command:`datasets`,describe:`Operations for log-explorer.datasets`,builder:e=>e.command(U).command(re).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ae(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)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const oe={command:`sql`,describe:`Run a SQL query against account-level datasets. Timestamp fields are RFC3339 strings. Filter with: WHERE {timestamp_field} >= now() - INTERVAL '30' DAY WHERE {timestamp_field} >= '2026-04-01T00:00:00Z' WHERE {timestamp_field} BETWEEN '2026-04-01T00:00:00Z' AND '2026-04-30T23:59:59Z' Check /accounts/{account_id}/logs/explorer/datasets to see enabled account level datasets. Zone-level datasets will not appear here. Check /accounts/{account_id}/logs/explorer/datasets/available for the schemas, and the name of the timestamp fields. For zone-level datasets use the zone-scoped endpoint: POST /zones/{zone_id}/logs/explorer/query/sql For more information about the datasets, and the meaning of each field, check out https://developers.cloudflare.com/logs/logpush/logpush-job/datasets/`,builder:ae,handler:async t=>{if(t.dryRun){u({command:`cf logs log-explorer query accounts sql`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/logs/explorer/query/sql`,pathParams:{},bodyKind:`octet-stream`,body:t.body});return}let n=await o(t),r=t.local?m:await i(n);if(t.accountId=r,t.file){let e=p(t.file);l(await d(`Creating`,async()=>a(n,`POST`,`/accounts/${r}/logs/explorer/query/sql`,{body:e,headers:{"Content-Type":`text/plain`}})),{successLabel:`Created`});return}if(t.body){let e=f(t.body,`body`,`binary`);l(await d(`Creating`,async()=>a(n,`POST`,`/accounts/${r}/logs/explorer/query/sql`,{body:e,headers:{"Content-Type":`text/plain`}})),{successLabel:`Created`});return}l(await d(`Creating`,async()=>n.logs.logExplorer.query.accounts.sql({account_id:r})),{successLabel:`Created`})}},se={command:`accounts`,describe:`Operations for log-explorer.query.accounts`,builder:e=>e.command(oe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ce(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)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const le={command:`sql`,describe:`Run a SQL query against zone-level datasets. Timestamp fields are RFC3339 strings. Filter with: WHERE {timestamp_field} >= now() - INTERVAL '30' DAY WHERE {timestamp_field} >= '2026-04-01T00:00:00Z' WHERE {timestamp_field} BETWEEN '2026-04-01T00:00:00Z' AND '2026-04-30T23:59:59Z' Check /zones/{zone_id}/logs/explorer/datasets to see enabled zone level datasets. Check /zones/{zone_id}/logs/explorer/datasets/available for the schemas and the name of the timestamp fields. For account-level datasets use the account-scoped endpoint: POST /accounts/{account_id}/logs/explorer/query/sql For more information about the datasets, and the meaning of each field, check out https://developers.cloudflare.com/logs/logpush/logpush-job/datasets/`,builder:ce,handler:async e=>{if(e.dryRun){u({command:`cf logs log-explorer query zones sql`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/logs/explorer/query/sql`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`octet-stream`,body:e.body});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.file){let n=p(e.file);l(await d(`Creating`,async()=>a(t,`POST`,`/zones/${e.zoneId}/logs/explorer/query/sql`,{body:n,headers:{"Content-Type":`text/plain`}})),{successLabel:`Created`});return}if(e.body){let n=f(e.body,`body`,`binary`);l(await d(`Creating`,async()=>a(t,`POST`,`/zones/${e.zoneId}/logs/explorer/query/sql`,{body:n,headers:{"Content-Type":`text/plain`}})),{successLabel:`Created`});return}l(await d(`Creating`,async()=>t.logs.logExplorer.query.zones.sql({zone_id:r})),{successLabel:`Created`})}},ue={command:`zones`,describe:`Operations for log-explorer.query.zones`,builder:e=>e.command(le).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},de={command:`query`,describe:`Operations for log-explorer.query`,builder:e=>e.command(se).command(ue).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},fe={command:`log-explorer`,describe:`Operations for log-explorer`,builder:e=>e.command(ie).command(de).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function pe(e){return e.positional(`ray-id`,{type:`string`,description:`Ray identifier.`,demandOption:!0}).option(`fields`,{type:`string`,description:"The `/received` route by default returns a limited set of fields, and allows customers to override the default field set by specifying individual fields. The reasons for this are: 1. Most customers require only a small subset of fields, but that subset varies from customer to customer; 2. Flat schema is much easier to work with downstream (importing into BigTable etc); 3. Performance (time to process, file size). If `?fields=` is not specified, default field set is returned. This default field set may change at any time. When `?fields=` is provided, each record is returned with the specified fields. `fields` must be specified as a comma separated list without any whitespaces, and all fields must exist. The order in which fields are specified does not matter, and the order of fields in the response is not specified."}).option(`timestamps`,{type:`string`,description:"By default, timestamps in responses are returned as Unix nanosecond integers. The `?timestamps=` argument can be set to change the format in which response timestamps are returned. Possible values are: `unix`, `unixnano`, `rfc3339`. Note that `unix` and `unixnano` return timestamps as integers; `rfc3339` returns timestamps as strings.",choices:[`unix`,`unixnano`,`rfc3339`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $={command:`get <ray-id>`,describe:"The `/rayids` api route allows lookups by specific rayid. The rayids route will return zero, one, or more records (ray ids are not unique).",builder:h(pe),handler:async e=>{let t={fields:e.fields,timestamps:e.timestamps};if(e.dryRun){u({command:`cf logs rayid get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/logs/rayids/${e[`ray-id`]==null?`<ray-id>`:encodeURIComponent(String(e[`ray-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"ray-id":String(e[`ray-id`]??``)},query:t,bodyKind:`none`});return}let r=await o(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,l(await d(`Loading`,async()=>r.logs.rayid.get({zone_id:i,ray_id:e[`ray-id`],...t})),{successLabel:`Loaded`})}},me={command:`rayid`,describe:`Operations for rayid`,builder:e=>e.command($).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function he(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ge={command:`get`,describe:`Lists all fields available. The response is json object with key-value pairs, where keys are field names, and values are descriptions.`,builder:he,handler:async e=>{if(e.dryRun){u({command:`cf logs received fields get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/logs/received/fields`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>t.logs.received.fields.get({zone_id:r})),{successLabel:`Loaded`})}},_e={command:`fields`,describe:`Received log operations`,builder:e=>e.command(ge).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ve(e){return e.option(`start`,{type:`string`,description:`Sets the (inclusive) beginning of the requested time frame. This can be a unix timestamp (in seconds or nanoseconds), or an absolute timestamp that conforms to RFC 3339. At this point in time, it cannot exceed a time in the past greater than seven days.`}).option(`end`,{type:`string`,description:"Sets the (exclusive) end of the requested time frame. This can be a unix timestamp (in seconds or nanoseconds), or an absolute timestamp that conforms to RFC 3339. `end` must be at least five minutes earlier than now and must be later than `start`. Difference between `start` and `end` must be not greater than one hour.",demandOption:!0}).option(`fields`,{type:`string`,description:"The `/received` route by default returns a limited set of fields, and allows customers to override the default field set by specifying individual fields. The reasons for this are: 1. Most customers require only a small subset of fields, but that subset varies from customer to customer; 2. Flat schema is much easier to work with downstream (importing into BigTable etc); 3. Performance (time to process, file size). If `?fields=` is not specified, default field set is returned. This default field set may change at any time. When `?fields=` is provided, each record is returned with the specified fields. `fields` must be specified as a comma separated list without any whitespaces, and all fields must exist. The order in which fields are specified does not matter, and the order of fields in the response is not specified."}).option(`sample`,{type:`number`,description:"When `?sample=` is provided, a sample of matching records is returned. If `sample=0.1` then 10% of records will be returned. Sampling is random: repeated calls will not only return different records, but likely will also vary slightly in number of returned records. When `?count=` is also specified, `count` is applied to the number of returned records, not the sampled records. So, with `sample=0.05` and `count=7`, when there is a total of 100 records available, approximately five will be returned. When there are 1000 records, seven will be returned. When there are 10,000 records, seven will be returned."}).option(`count`,{type:`number`,description:"When `?count=` is provided, the response will contain up to `count` results. Since results are not sorted, you are likely to get different data for repeated requests. `count` must be an integer > 0."}).option(`timestamps`,{type:`string`,description:"By default, timestamps in responses are returned as Unix nanosecond integers. The `?timestamps=` argument can be set to change the format in which response timestamps are returned. Possible values are: `unix`, `unixnano`, `rfc3339`. Note that `unix` and `unixnano` return timestamps as integers; `rfc3339` returns timestamps as strings.",choices:[`unix`,`unixnano`,`rfc3339`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ye={command:`get`,describe:'The `/received` api route allows customers to retrieve their edge HTTP logs. The basic access pattern is "give me all the logs for zone Z for minute M", where the minute M refers to the time records were received at Cloudflare\'s central data center. `start` is inclusive, and `end` is exclusive. Because of that, to get all data, at minutely cadence, starting at 10AM, the proper values are: `start=2018-05-20T10:00:00Z&end=2018-05-20T10:01:00Z`, then `start=2018-05-20T10:01:00Z&end=2018-05-20T10:02:00Z` and so on; the overlap will be handled properly.',builder:h(ve),handler:async e=>{let t={start:e.start,end:e.end,fields:e.fields,sample:e.sample,count:e.count,timestamps:e.timestamps};if(e.dryRun){u({command:`cf logs received get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/logs/received`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let r=await o(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,l(await d(`Loading`,async()=>r.logs.received.get({zone_id:i,...t})),{successLabel:`Loaded`})}},be={command:`received`,describe:`Received log operations`,builder:e=>e.command(ye).command(_e).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function xe(e){return e.option(`start`,{type:`string`,description:`Start time in RFC3339 format.`,demandOption:!0}).option(`end`,{type:`string`,description:`End time in RFC3339 format.`,demandOption:!0}).option(`bucket`,{type:`string`,description:`R2 bucket name.`,demandOption:!0}).option(`prefix`,{type:`string`,description:`R2 bucket prefix logs are stored under.`}).option(`r2-access-key-id`,{type:`string`,description:`The R2-Access-Key-Id header`,demandOption:!0}).option(`r2-secret-access-key`,{type:`string`,description:`The R2-Secret-Access-Key header`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Se={command:`get`,describe:`Returns logs stored in R2 that match the provided query parameters.`,builder:xe,handler:async t=>{let n={start:t.start,end:t.end,bucket:t.bucket,prefix:t.prefix},r={};if(t[`r2-access-key-id`]!==void 0&&(r[`R2-Access-Key-Id`]=String(t[`r2-access-key-id`])),t[`r2-secret-access-key`]!==void 0&&(r[`R2-Secret-Access-Key`]=String(t[`r2-secret-access-key`])),t.dryRun){u({command:`cf logs retrieve get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/logs/retrieve`,pathParams:{},query:n,bodyKind:`none`});return}let s=await o(t),c=t.local?m:await i(s);t.accountId=c,l(await d(`Loading`,async()=>a(s,`GET`,`/accounts/${c}/logs/retrieve`,{query:n,headers:Object.keys(r).length>0?r:void 0})),{successLabel:`Loaded`})}},Ce={command:`retrieve`,describe:`Operations for retrieve`,builder:e=>e.command(Se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},we={command:`logs`,describe:`Log control, retention, and raw log access — CMB config, ray ID lookups, and received fields`,builder:e=>e.command(O).command(j).command(fe).command(me).command(be).command(Ce).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{we as default};
@@ -1,5 +1,5 @@
1
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 v(e){return e.option(`forwarded`,{type:`string`,description:`The forwarded header`}).option(`description`,{type:`string`,description:`The description field`}).option(`destination-type`,{type:`string`,description:`The destination_type field`,choices:[`NONE`,`ZERO_TRUST_LIST`]}).option(`name`,{type:`string`,description:`The name field`}).option(`policy`,{type:`string`,description:`The policy field`}).option(`update-mode`,{type:`string`,description:`The update_mode field`,choices:[`AUTO`,`MANUAL`]}).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 ee={command:`create`,describe:`Create a new Catalog Sync (Closed Beta).`,builder:v,handler:async r=>{let h={};if(r.forwarded!==void 0&&(h.forwarded=String(r.forwarded)),r.dryRun){d({command:`cf magic-cloud-networking catalog-syncs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/catalog-syncs`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({description:p(r.description,`description`,`text`),destination_type:p(r[`destination-type`],`destination-type`,`text`),name:p(r.name,`name`,`text`),policy:p(r.policy,`policy`,`text`),update_mode:p(r[`update-mode`],`update-mode`,`text`)}):s(r.body)});return}let g=await o(r),_=r.local?m:await i(g);if(r.accountId=_,r.body){let e=s(r.body);u(await f(`Creating`,async()=>a(g,`POST`,`/accounts/${_}/magic/cloud/catalog-syncs`,{body:e,headers:Object.keys(h).length>0?h:void 0})),{successLabel:`Created`});return}r[`destination-type`]===void 0&&(r[`destination-type`]=await n(`destination-type`,`The destination_type field`,[`NONE`,`ZERO_TRUST_LIST`])),r.name===void 0&&(r.name=await t(`name`,`The name field`)),r[`update-mode`]===void 0&&(r[`update-mode`]=await n(`update-mode`,`The update_mode field`,[`AUTO`,`MANUAL`]));let v={};r.description!==void 0&&c(v,[`description`],p(r.description,`description`,`text`)),r[`destination-type`]!==void 0&&c(v,[`destination_type`],p(r[`destination-type`],`destination-type`,`text`)),r.name!==void 0&&c(v,[`name`],p(r.name,`name`,`text`)),r.policy!==void 0&&c(v,[`policy`],p(r.policy,`policy`,`text`)),r[`update-mode`]!==void 0&&c(v,[`update_mode`],p(r[`update-mode`],`update-mode`,`text`)),u(await f(`Creating`,async()=>a(g,`POST`,`/accounts/${_}/magic/cloud/catalog-syncs`,{body:Object.keys(v).length>0?v:void 0,headers:Object.keys(h).length>0?h:void 0})),{successLabel:`Created`})}};function te(e){return e.positional(`sync-id`,{type:`string`,description:`Sync ID`,demandOption:!0}).option(`delete-destination`,{type:`boolean`,description:`Delete destination`}).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:`delete <sync-id>`,describe:`Delete a Catalog Sync (Closed Beta).`,builder:te,handler:async t=>{let n={delete_destination:t[`delete-destination`]};if(t.dryRun){d({command:`cf magic-cloud-networking catalog-syncs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/catalog-syncs/${t[`sync-id`]==null?`<sync-id>`:encodeURIComponent(String(t[`sync-id`]))}`,pathParams:{"sync-id":String(t[`sync-id`]??``)},query:n,bodyKind:`none`});return}let a=await o(t),s=t.local?m:await i(a);if(t.accountId=s,!await r({force:!!t.force})){process.stderr.write(`Aborted.
2
+ import{C as e,D as t,E as n,T as r,_ as i,i as a,n as o}from"./auth-BqDOIrKX.mjs";import{n as s,r as c,t as l}from"./body-parser-CBpeIUns.mjs";import{t as u}from"./output-CUxZRM5A.mjs";import{n as d,t as f}from"./progress-Cent9Lsg.mjs";import{n as p}from"./input-validation-CTqtyiY9.mjs";import{t as m}from"./local-D8bhHUMK.mjs";import{t as h}from"./cli-types-CMNMD1V7.mjs";import{n as g,t as _}from"./raw-fetch-DnbAMFBp.mjs";function v(e){return e.option(`forwarded`,{type:`string`,description:`The forwarded header`}).option(`description`,{type:`string`,description:`The description field`}).option(`destination-type`,{type:`string`,description:`The destination_type field`,choices:[`NONE`,`ZERO_TRUST_LIST`]}).option(`name`,{type:`string`,description:`The name field`}).option(`policy`,{type:`string`,description:`The policy field`}).option(`update-mode`,{type:`string`,description:`The update_mode field`,choices:[`AUTO`,`MANUAL`]}).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 ee={command:`create`,describe:`Create a new Catalog Sync (Closed Beta).`,builder:v,handler:async r=>{let h={};if(r.forwarded!==void 0&&(h.forwarded=String(r.forwarded)),r.dryRun){d({command:`cf magic-cloud-networking catalog-syncs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/catalog-syncs`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({description:p(r.description,`description`,`text`),destination_type:p(r[`destination-type`],`destination-type`,`text`),name:p(r.name,`name`,`text`),policy:p(r.policy,`policy`,`text`),update_mode:p(r[`update-mode`],`update-mode`,`text`)}):s(r.body)});return}let g=await o(r),_=r.local?m:await i(g);if(r.accountId=_,r.body){let e=s(r.body);u(await f(`Creating`,async()=>a(g,`POST`,`/accounts/${_}/magic/cloud/catalog-syncs`,{body:e,headers:Object.keys(h).length>0?h:void 0})),{successLabel:`Created`});return}r[`destination-type`]===void 0&&(r[`destination-type`]=await n(`destination-type`,`The destination_type field`,[`NONE`,`ZERO_TRUST_LIST`])),r.name===void 0&&(r.name=await t(`name`,`The name field`)),r[`update-mode`]===void 0&&(r[`update-mode`]=await n(`update-mode`,`The update_mode field`,[`AUTO`,`MANUAL`]));let v={};r.description!==void 0&&c(v,[`description`],p(r.description,`description`,`text`)),r[`destination-type`]!==void 0&&c(v,[`destination_type`],p(r[`destination-type`],`destination-type`,`text`)),r.name!==void 0&&c(v,[`name`],p(r.name,`name`,`text`)),r.policy!==void 0&&c(v,[`policy`],p(r.policy,`policy`,`text`)),r[`update-mode`]!==void 0&&c(v,[`update_mode`],p(r[`update-mode`],`update-mode`,`text`)),u(await f(`Creating`,async()=>a(g,`POST`,`/accounts/${_}/magic/cloud/catalog-syncs`,{body:Object.keys(v).length>0?v:void 0,headers:Object.keys(h).length>0?h:void 0})),{successLabel:`Created`})}};function te(e){return e.positional(`sync-id`,{type:`string`,description:`Sync ID`,demandOption:!0}).option(`delete-destination`,{type:`boolean`,description:`Delete destination`}).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:`delete <sync-id>`,describe:`Delete a Catalog Sync (Closed Beta).`,builder:te,handler:async t=>{let n={delete_destination:t[`delete-destination`]};if(t.dryRun){d({command:`cf magic-cloud-networking catalog-syncs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/catalog-syncs/${t[`sync-id`]==null?`<sync-id>`:encodeURIComponent(String(t[`sync-id`]))}`,pathParams:{"sync-id":String(t[`sync-id`]??``)},query:n,bodyKind:`none`});return}let a=await o(t),s=t.local?m:await i(a);if(t.accountId=s,!await r({force:!!t.force})){process.stderr.write(`Aborted.
3
3
  `);return}u(await f(`Deleting`,async()=>a.magicCloudNetworking.catalogSyncs.delete({account_id:s,sync_id:t[`sync-id`],...n})),{successLabel:`Deleted`})}};function b(e){return e.positional(`sync-id`,{type:`string`,description:`Sync ID`,demandOption:!0}).option(`description`,{type:`string`,description:`The description field`}).option(`name`,{type:`string`,description:`The name field`}).option(`policy`,{type:`string`,description:`The policy field`}).option(`update-mode`,{type:`string`,description:`The update_mode field`,choices:[`AUTO`,`MANUAL`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const x={command:`edit <sync-id>`,describe:`Update a Catalog Sync (Closed Beta).`,builder:b,handler:async t=>{if(t.dryRun){d({command:`cf magic-cloud-networking catalog-syncs edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/catalog-syncs/${t[`sync-id`]==null?`<sync-id>`:encodeURIComponent(String(t[`sync-id`]))}`,pathParams:{"sync-id":String(t[`sync-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({description:p(t.description,`description`,`text`),name:p(t.name,`name`,`text`),policy:p(t.policy,`policy`,`text`),update_mode:p(t[`update-mode`],`update-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.magicCloudNetworking.catalogSyncs.edit({body:e,account_id:r,sync_id:t[`sync-id`]})),{successLabel:`Updated`});return}let a=l({description:p(t.description,`description`,`text`),name:p(t.name,`name`,`text`),policy:p(t.policy,`policy`,`text`),update_mode:p(t[`update-mode`],`update-mode`,`text`)});u(await f(`Updating`,async()=>n.magicCloudNetworking.catalogSyncs.edit({body:a,account_id:r,sync_id:t[`sync-id`]})),{successLabel:`Updated`})}};function S(e){return e.positional(`sync-id`,{type:`string`,description:`Sync ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`get <sync-id>`,describe:`Read a Catalog Sync (Closed Beta).`,builder:S,handler:async t=>{if(t.dryRun){d({command:`cf magic-cloud-networking catalog-syncs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/catalog-syncs/${t[`sync-id`]==null?`<sync-id>`:encodeURIComponent(String(t[`sync-id`]))}`,pathParams:{"sync-id":String(t[`sync-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.magicCloudNetworking.catalogSyncs.get({account_id:r,sync_id:t[`sync-id`]})),{successLabel:`Loaded`})}};function w(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`list`,describe:`List Catalog Syncs (Closed Beta).`,builder:w,handler:async t=>{if(t.dryRun){d({command:`cf magic-cloud-networking catalog-syncs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/catalog-syncs`,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.magicCloudNetworking.catalogSyncs.list({account_id:r})),{successLabel:`Loaded`})}};function E(e){return e.option(`destination-type`,{type:`string`,description:`Specify type of destination, omit to return all.`,choices:[`NONE`,`ZERO_TRUST_LIST`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`list`,describe:`List prebuilt catalog sync policies (Closed Beta).`,builder:h(E),handler:async t=>{let n={destination_type:t[`destination-type`]};if(t.dryRun){d({command:`cf magic-cloud-networking catalog-syncs prebuilt-policies list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/catalog-syncs/prebuilt-policies`,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.magicCloudNetworking.catalogSyncs.prebuiltPolicies.list({account_id:a,...n})),{successLabel:`Loaded`})}},O={command:`prebuilt-policies`,describe:`Synchronize cloud resource inventories from AWS, Azure, and GCP into a unified catalog`,builder:e=>e.command(D).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function k(e){return e.positional(`sync-id`,{type:`string`,description:`Sync ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`refresh <sync-id>`,describe:`Refresh a Catalog Sync's destination by running the sync policy against latest resource catalog (Closed Beta).`,builder:k,handler:async t=>{if(t.dryRun){d({command:`cf magic-cloud-networking catalog-syncs refresh`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/catalog-syncs/${t[`sync-id`]==null?`<sync-id>`:encodeURIComponent(String(t[`sync-id`]))}/refresh`,pathParams:{"sync-id":String(t[`sync-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.magicCloudNetworking.catalogSyncs.refresh({account_id:r,sync_id:t[`sync-id`]})),{successLabel:`Created`})}};function j(e){return e.positional(`sync-id`,{type:`string`,description:`Sync ID`,demandOption:!0}).option(`description`,{type:`string`,description:`The description field`}).option(`name`,{type:`string`,description:`The name field`}).option(`policy`,{type:`string`,description:`The policy field`}).option(`update-mode`,{type:`string`,description:`The update_mode field`,choices:[`AUTO`,`MANUAL`]}).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 M={command:`update <sync-id>`,describe:`Update a Catalog Sync (Closed Beta).`,builder:j,handler:async t=>{if(t.dryRun){d({command:`cf magic-cloud-networking catalog-syncs update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/catalog-syncs/${t[`sync-id`]==null?`<sync-id>`:encodeURIComponent(String(t[`sync-id`]))}`,pathParams:{"sync-id":String(t[`sync-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({description:p(t.description,`description`,`text`),name:p(t.name,`name`,`text`),policy:p(t.policy,`policy`,`text`),update_mode:p(t[`update-mode`],`update-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.magicCloudNetworking.catalogSyncs.update({body:e,account_id:r,sync_id:t[`sync-id`]})),{successLabel:`Updated`});return}let a=l({description:p(t.description,`description`,`text`),name:p(t.name,`name`,`text`),policy:p(t.policy,`policy`,`text`),update_mode:p(t[`update-mode`],`update-mode`,`text`)});u(await f(`Updating`,async()=>n.magicCloudNetworking.catalogSyncs.update({body:a,account_id:r,sync_id:t[`sync-id`]})),{successLabel:`Updated`})}},N={command:`catalog-syncs`,describe:`Synchronize cloud resource inventories from AWS, Azure, and GCP into a unified catalog`,builder:e=>e.command(ee).command(y).command(x).command(C).command(T).command(A).command(M).command(O).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function P(e){return e.option(`forwarded`,{type:`string`,description:`The forwarded header`}).option(`cloud-type`,{type:`string`,description:`The cloud_type field`,choices:[`AWS`,`AZURE`,`GOOGLE`,`CLOUDFLARE`]}).option(`description`,{type:`string`,description:`The description field`}).option(`friendly-name`,{type:`string`,description:`The friendly_name 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 F={command:`create`,describe:`Create a new Cloud Integration (Closed Beta).`,builder:P,handler:async r=>{let h={};if(r.forwarded!==void 0&&(h.forwarded=String(r.forwarded)),r.dryRun){d({command:`cf magic-cloud-networking cloud-integrations create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/providers`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({cloud_type:p(r[`cloud-type`],`cloud-type`,`text`),description:p(r.description,`description`,`text`),friendly_name:p(r[`friendly-name`],`friendly-name`,`text`)}):s(r.body)});return}let g=await o(r),_=r.local?m:await i(g);if(r.accountId=_,r.body){let e=s(r.body);u(await f(`Creating`,async()=>a(g,`POST`,`/accounts/${_}/magic/cloud/providers`,{body:e,headers:Object.keys(h).length>0?h:void 0})),{successLabel:`Created`});return}r[`cloud-type`]===void 0&&(r[`cloud-type`]=await n(`cloud-type`,`The cloud_type field`,[`AWS`,`AZURE`,`GOOGLE`,`CLOUDFLARE`])),r[`friendly-name`]===void 0&&(r[`friendly-name`]=await t(`friendly-name`,`The friendly_name field`));let v={};r[`cloud-type`]!==void 0&&c(v,[`cloud_type`],p(r[`cloud-type`],`cloud-type`,`text`)),r.description!==void 0&&c(v,[`description`],p(r.description,`description`,`text`)),r[`friendly-name`]!==void 0&&c(v,[`friendly_name`],p(r[`friendly-name`],`friendly-name`,`text`)),u(await f(`Creating`,async()=>a(g,`POST`,`/accounts/${_}/magic/cloud/providers`,{body:Object.keys(v).length>0?v:void 0,headers:Object.keys(h).length>0?h:void 0})),{successLabel:`Created`})}};function I(e){return e.positional(`provider-id`,{type:`string`,description:`Provider 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 L={command:`delete <provider-id>`,describe:`Delete a Cloud Integration (Closed Beta).`,builder:I,handler:async t=>{if(t.dryRun){d({command:`cf magic-cloud-networking cloud-integrations delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/providers/${t[`provider-id`]==null?`<provider-id>`:encodeURIComponent(String(t[`provider-id`]))}`,pathParams:{"provider-id":String(t[`provider-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
4
  `);return}u(await f(`Deleting`,async()=>n.magicCloudNetworking.cloudIntegrations.delete({account_id:a,provider_id:t[`provider-id`]})),{successLabel:`Deleted`})}};function R(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const z={command:`discover-all`,describe:`Run discovery for all Cloud Integrations in an account (Closed Beta).`,builder:R,handler:async t=>{if(t.dryRun){d({command:`cf magic-cloud-networking cloud-integrations discover-all`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/providers/discover`,pathParams:{},bodyKind:`none`});return}let n=await o(t),r=t.local?m:await i(n);t.accountId=r,u(await f(`Creating`,async()=>n.magicCloudNetworking.cloudIntegrations.discoverAll({account_id:r})),{successLabel:`Created`})}};function B(e){return e.positional(`provider-id`,{type:`string`,description:`Provider ID`,demandOption:!0}).option(`v2`,{type:`boolean`,description:`V2`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const V={command:`discover <provider-id>`,describe:`Run discovery for a Cloud Integration (Closed Beta).`,builder:B,handler:async t=>{let n={v2:t.v2};if(t.dryRun){d({command:`cf magic-cloud-networking cloud-integrations discover`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/providers/${t[`provider-id`]==null?`<provider-id>`:encodeURIComponent(String(t[`provider-id`]))}/discover`,pathParams:{"provider-id":String(t[`provider-id`]??``)},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?m:await i(r);t.accountId=a,u(await f(`Creating`,async()=>r.magicCloudNetworking.cloudIntegrations.discover({account_id:a,provider_id:t[`provider-id`],...n})),{successLabel:`Created`})}};function H(e){return e.positional(`provider-id`,{type:`string`,description:`Provider ID`,demandOption:!0}).option(`aws-arn`,{type:`string`,description:`The aws_arn field`}).option(`azure-subscription-id`,{type:`string`,description:`The azure_subscription_id field`}).option(`azure-tenant-id`,{type:`string`,description:`The azure_tenant_id field`}).option(`description`,{type:`string`,description:`The description field`}).option(`friendly-name`,{type:`string`,description:`The friendly_name field`}).option(`gcp-project-id`,{type:`string`,description:`The gcp_project_id field`}).option(`gcp-service-account-email`,{type:`string`,description:`The gcp_service_account_email 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 U={command:`edit <provider-id>`,describe:`Update a Cloud Integration (Closed Beta).`,builder:H,handler:async t=>{if(t.dryRun){d({command:`cf magic-cloud-networking cloud-integrations edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/providers/${t[`provider-id`]==null?`<provider-id>`:encodeURIComponent(String(t[`provider-id`]))}`,pathParams:{"provider-id":String(t[`provider-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({aws_arn:p(t[`aws-arn`],`aws-arn`,`text`),azure_subscription_id:p(t[`azure-subscription-id`],`azure-subscription-id`,`text`),azure_tenant_id:p(t[`azure-tenant-id`],`azure-tenant-id`,`text`),description:p(t.description,`description`,`text`),friendly_name:p(t[`friendly-name`],`friendly-name`,`text`),gcp_project_id:p(t[`gcp-project-id`],`gcp-project-id`,`text`),gcp_service_account_email:p(t[`gcp-service-account-email`],`gcp-service-account-email`,`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.magicCloudNetworking.cloudIntegrations.edit({body:e,account_id:r,provider_id:t[`provider-id`]})),{successLabel:`Updated`});return}let a=l({aws_arn:p(t[`aws-arn`],`aws-arn`,`text`),azure_subscription_id:p(t[`azure-subscription-id`],`azure-subscription-id`,`text`),azure_tenant_id:p(t[`azure-tenant-id`],`azure-tenant-id`,`text`),description:p(t.description,`description`,`text`),friendly_name:p(t[`friendly-name`],`friendly-name`,`text`),gcp_project_id:p(t[`gcp-project-id`],`gcp-project-id`,`text`),gcp_service_account_email:p(t[`gcp-service-account-email`],`gcp-service-account-email`,`text`)});u(await f(`Updating`,async()=>n.magicCloudNetworking.cloudIntegrations.edit({body:a,account_id:r,provider_id:t[`provider-id`]})),{successLabel:`Updated`})}};function W(e){return e.positional(`provider-id`,{type:`string`,description:`Provider ID`,demandOption:!0}).option(`status`,{type:`boolean`,description:`Status`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const G={command:`get <provider-id>`,describe:`Read a Cloud Integration (Closed Beta).`,builder:W,handler:async t=>{let n={status:t.status};if(t.dryRun){d({command:`cf magic-cloud-networking cloud-integrations get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/providers/${t[`provider-id`]==null?`<provider-id>`:encodeURIComponent(String(t[`provider-id`]))}`,pathParams:{"provider-id":String(t[`provider-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.magicCloudNetworking.cloudIntegrations.get({account_id:a,provider_id:t[`provider-id`],...n})),{successLabel:`Loaded`})}};function K(e){return e.positional(`provider-id`,{type:`string`,description:`Provider ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const q={command:`initial-setup <provider-id>`,describe:`Get initial configuration to complete Cloud Integration setup (Closed Beta).`,builder:K,handler:async t=>{if(t.dryRun){d({command:`cf magic-cloud-networking cloud-integrations initial-setup`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/providers/${t[`provider-id`]==null?`<provider-id>`:encodeURIComponent(String(t[`provider-id`]))}/initial_setup`,pathParams:{"provider-id":String(t[`provider-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.magicCloudNetworking.cloudIntegrations.initialSetup({account_id:r,provider_id:t[`provider-id`]})),{successLabel:`Loaded`})}};function J(e){return e.option(`status`,{type:`boolean`,description:`Status`}).option(`order-by`,{type:`string`,description:`One of ["updated_at", "id", "cloud_type", "name"].`}).option(`desc`,{type:`boolean`,description:`Desc`}).option(`cloudflare`,{type:`boolean`,description:`Cloudflare`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Y={command:`list`,describe:`List Cloud Integrations (Closed Beta).`,builder:J,handler:async t=>{let n={status:t.status,order_by:t[`order-by`],desc:t.desc,cloudflare:t.cloudflare};if(t.dryRun){d({command:`cf magic-cloud-networking cloud-integrations list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/providers`,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.magicCloudNetworking.cloudIntegrations.list({account_id:a,...n})),{successLabel:`Loaded`})}};function X(e){return e.positional(`provider-id`,{type:`string`,description:`Provider ID`,demandOption:!0}).option(`aws-arn`,{type:`string`,description:`The aws_arn field`}).option(`azure-subscription-id`,{type:`string`,description:`The azure_subscription_id field`}).option(`azure-tenant-id`,{type:`string`,description:`The azure_tenant_id field`}).option(`description`,{type:`string`,description:`The description field`}).option(`friendly-name`,{type:`string`,description:`The friendly_name field`}).option(`gcp-project-id`,{type:`string`,description:`The gcp_project_id field`}).option(`gcp-service-account-email`,{type:`string`,description:`The gcp_service_account_email 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 Z={command:`update <provider-id>`,describe:`Update a Cloud Integration (Closed Beta).`,builder:X,handler:async t=>{if(t.dryRun){d({command:`cf magic-cloud-networking cloud-integrations update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/providers/${t[`provider-id`]==null?`<provider-id>`:encodeURIComponent(String(t[`provider-id`]))}`,pathParams:{"provider-id":String(t[`provider-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({aws_arn:p(t[`aws-arn`],`aws-arn`,`text`),azure_subscription_id:p(t[`azure-subscription-id`],`azure-subscription-id`,`text`),azure_tenant_id:p(t[`azure-tenant-id`],`azure-tenant-id`,`text`),description:p(t.description,`description`,`text`),friendly_name:p(t[`friendly-name`],`friendly-name`,`text`),gcp_project_id:p(t[`gcp-project-id`],`gcp-project-id`,`text`),gcp_service_account_email:p(t[`gcp-service-account-email`],`gcp-service-account-email`,`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.magicCloudNetworking.cloudIntegrations.update({body:e,account_id:r,provider_id:t[`provider-id`]})),{successLabel:`Updated`});return}let a=l({aws_arn:p(t[`aws-arn`],`aws-arn`,`text`),azure_subscription_id:p(t[`azure-subscription-id`],`azure-subscription-id`,`text`),azure_tenant_id:p(t[`azure-tenant-id`],`azure-tenant-id`,`text`),description:p(t.description,`description`,`text`),friendly_name:p(t[`friendly-name`],`friendly-name`,`text`),gcp_project_id:p(t[`gcp-project-id`],`gcp-project-id`,`text`),gcp_service_account_email:p(t[`gcp-service-account-email`],`gcp-service-account-email`,`text`)});u(await f(`Updating`,async()=>n.magicCloudNetworking.cloudIntegrations.update({body:a,account_id:r,provider_id:t[`provider-id`]})),{successLabel:`Updated`})}},Q={command:`cloud-integrations`,describe:`Cloud provider credentials and integrations for resource discovery and on-ramp provisioning`,builder:e=>e.command(F).command(L).command(V).command(z).command(U).command(G).command(q).command(Y).command(Z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ne(e){return e.option(`prefixes`,{type:`string`,array:!0,description:`The prefixes 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 re={command:`edit`,describe:`Update the Magic WAN Address Space (Closed Beta).`,builder:ne,handler:async t=>{if(t.dryRun){d({command:`cf magic-cloud-networking on-ramps address-spaces edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/onramps/magic_wan_address_space`,pathParams:{},bodyKind:`json`,body:t.body===void 0?l({prefixes:t.prefixes}):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.magicCloudNetworking.onRamps.addressSpaces.edit({body:e,account_id:r})),{successLabel:`Updated`});return}if(t.prefixes===void 0)throw Error(`--prefixes is required (or pass --body with this field set).`);let a=l({prefixes:t.prefixes});u(await f(`Updating`,async()=>n.magicCloudNetworking.onRamps.addressSpaces.edit({body:a,account_id:r})),{successLabel:`Updated`})}};function ie(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ae={command:`list`,describe:`Read the Magic WAN Address Space (Closed Beta).`,builder:ie,handler:async t=>{if(t.dryRun){d({command:`cf magic-cloud-networking on-ramps address-spaces list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/onramps/magic_wan_address_space`,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.magicCloudNetworking.onRamps.addressSpaces.list({account_id:r})),{successLabel:`Loaded`})}};function oe(e){return e.option(`prefixes`,{type:`string`,array:!0,description:`The prefixes 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 se={command:`update`,describe:`Update the Magic WAN Address Space (Closed Beta).`,builder:oe,handler:async t=>{if(t.dryRun){d({command:`cf magic-cloud-networking on-ramps address-spaces update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/onramps/magic_wan_address_space`,pathParams:{},bodyKind:`json`,body:t.body===void 0?l({prefixes:t.prefixes}):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.magicCloudNetworking.onRamps.addressSpaces.update({body:e,account_id:r})),{successLabel:`Updated`});return}if(t.prefixes===void 0)throw Error(`--prefixes is required (or pass --body with this field set).`);let a=l({prefixes:t.prefixes});u(await f(`Updating`,async()=>n.magicCloudNetworking.onRamps.addressSpaces.update({body:a,account_id:r})),{successLabel:`Updated`})}},ce={command:`address-spaces`,describe:`On-ramp connections that bridge cloud VPCs/VNets to your Cloudflare network`,builder:e=>e.command(re).command(ae).command(se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function le(e){return e.positional(`onramp-id`,{type:`string`,description:`Onramp ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ue={command:`apply <onramp-id>`,describe:`Apply an On-ramp (Closed Beta).`,builder:le,handler:async t=>{if(t.dryRun){d({command:`cf magic-cloud-networking on-ramps apply`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/onramps/${t[`onramp-id`]==null?`<onramp-id>`:encodeURIComponent(String(t[`onramp-id`]))}/apply`,pathParams:{"onramp-id":String(t[`onramp-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.magicCloudNetworking.onRamps.apply({account_id:r,onramp_id:t[`onramp-id`]})),{successLabel:`Created`})}};function de(e){return e.option(`forwarded`,{type:`string`,description:`The forwarded header`}).option(`adopted-hub-id`,{type:`string`,description:`The adopted_hub_id field`}).option(`attached-hubs`,{type:`string`,array:!0,description:`The attached_hubs field`}).option(`attached-vpcs`,{type:`string`,array:!0,description:`The attached_vpcs field`}).option(`cloud-asn`,{type:`number`,description:`Sets the cloud-side ASN. If unset or zero, the cloud's default ASN takes effect.`}).option(`cloud-type`,{type:`string`,description:`The cloud_type field`,choices:[`AWS`,`AZURE`,`GOOGLE`]}).option(`description`,{type:`string`,description:`The description field`}).option(`dynamic-routing`,{type:`boolean`,description:`Enables BGP routing. When enabling this feature, set both install_routes_in_cloud and install_routes_in_magic_wan to false.`}).option(`hub-provider-id`,{type:`string`,description:`The hub_provider_id field`}).option(`install-routes-in-cloud`,{type:`boolean`,description:`The install_routes_in_cloud field`}).option(`install-routes-in-magic-wan`,{type:`boolean`,description:`The install_routes_in_magic_wan field`}).option(`manage-hub-to-hub-attachments`,{type:`boolean`,description:`The manage_hub_to_hub_attachments field`}).option(`manage-vpc-to-hub-attachments`,{type:`boolean`,description:`The manage_vpc_to_hub_attachments field`}).option(`name`,{type:`string`,description:`The name field`}).option(`region`,{type:`string`,description:`The region field`}).option(`type`,{type:`string`,description:`The type field`,choices:[`OnrampTypeSingle`,`OnrampTypeHub`]}).option(`vpc`,{type:`string`,description:`The vpc 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 fe={command:`create`,describe:`Create a new On-ramp (Closed Beta).`,builder:de,handler:async r=>{let h={};if(r.forwarded!==void 0&&(h.forwarded=String(r.forwarded)),r.dryRun){d({command:`cf magic-cloud-networking on-ramps create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/onramps`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({adopted_hub_id:p(r[`adopted-hub-id`],`adopted-hub-id`,`text`),attached_hubs:r[`attached-hubs`],attached_vpcs:r[`attached-vpcs`],cloud_asn:r[`cloud-asn`],cloud_type:p(r[`cloud-type`],`cloud-type`,`text`),description:p(r.description,`description`,`text`),dynamic_routing:r[`dynamic-routing`],hub_provider_id:p(r[`hub-provider-id`],`hub-provider-id`,`text`),install_routes_in_cloud:r[`install-routes-in-cloud`],install_routes_in_magic_wan:r[`install-routes-in-magic-wan`],manage_hub_to_hub_attachments:r[`manage-hub-to-hub-attachments`],manage_vpc_to_hub_attachments:r[`manage-vpc-to-hub-attachments`],name:p(r.name,`name`,`text`),region:p(r.region,`region`,`text`),type:p(r.type,`type`,`text`),vpc:p(r.vpc,`vpc`,`text`)}):s(r.body)});return}let g=await o(r),_=r.local?m:await i(g);if(r.accountId=_,r.body){let e=s(r.body);u(await f(`Creating`,async()=>a(g,`POST`,`/accounts/${_}/magic/cloud/onramps`,{body:e,headers:Object.keys(h).length>0?h:void 0})),{successLabel:`Created`});return}if(r[`cloud-type`]===void 0&&(r[`cloud-type`]=await n(`cloud-type`,`The cloud_type field`,[`AWS`,`AZURE`,`GOOGLE`])),r[`dynamic-routing`]===void 0)throw Error(`--dynamic-routing is required (or pass --body with this field set).`);if(r[`install-routes-in-cloud`]===void 0)throw Error(`--install-routes-in-cloud is required (or pass --body with this field set).`);if(r[`install-routes-in-magic-wan`]===void 0)throw Error(`--install-routes-in-magic-wan is required (or pass --body with this field set).`);r.name===void 0&&(r.name=await t(`name`,`The name field`)),r.type===void 0&&(r.type=await n(`type`,`The type field`,[`OnrampTypeSingle`,`OnrampTypeHub`]));let v={};r[`adopted-hub-id`]!==void 0&&c(v,[`adopted_hub_id`],p(r[`adopted-hub-id`],`adopted-hub-id`,`text`)),r[`attached-hubs`]!==void 0&&c(v,[`attached_hubs`],r[`attached-hubs`]),r[`attached-vpcs`]!==void 0&&c(v,[`attached_vpcs`],r[`attached-vpcs`]),r[`cloud-asn`]!==void 0&&c(v,[`cloud_asn`],r[`cloud-asn`]),r[`cloud-type`]!==void 0&&c(v,[`cloud_type`],p(r[`cloud-type`],`cloud-type`,`text`)),r.description!==void 0&&c(v,[`description`],p(r.description,`description`,`text`)),r[`dynamic-routing`]!==void 0&&c(v,[`dynamic_routing`],r[`dynamic-routing`]),r[`hub-provider-id`]!==void 0&&c(v,[`hub_provider_id`],p(r[`hub-provider-id`],`hub-provider-id`,`text`)),r[`install-routes-in-cloud`]!==void 0&&c(v,[`install_routes_in_cloud`],r[`install-routes-in-cloud`]),r[`install-routes-in-magic-wan`]!==void 0&&c(v,[`install_routes_in_magic_wan`],r[`install-routes-in-magic-wan`]),r[`manage-hub-to-hub-attachments`]!==void 0&&c(v,[`manage_hub_to_hub_attachments`],r[`manage-hub-to-hub-attachments`]),r[`manage-vpc-to-hub-attachments`]!==void 0&&c(v,[`manage_vpc_to_hub_attachments`],r[`manage-vpc-to-hub-attachments`]),r.name!==void 0&&c(v,[`name`],p(r.name,`name`,`text`)),r.region!==void 0&&c(v,[`region`],p(r.region,`region`,`text`)),r.type!==void 0&&c(v,[`type`],p(r.type,`type`,`text`)),r.vpc!==void 0&&c(v,[`vpc`],p(r.vpc,`vpc`,`text`)),u(await f(`Creating`,async()=>a(g,`POST`,`/accounts/${_}/magic/cloud/onramps`,{body:Object.keys(v).length>0?v:void 0,headers:Object.keys(h).length>0?h:void 0})),{successLabel:`Created`})}};function pe(e){return e.positional(`onramp-id`,{type:`string`,description:`Onramp ID`,demandOption:!0}).option(`destroy`,{type:`boolean`,description:`Destroy`}).option(`force`,{type:`boolean`,description:`Force`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const me={command:`delete <onramp-id>`,describe:`Delete an On-ramp (Closed Beta).`,builder:pe,handler:async t=>{let n={destroy:t.destroy,force:t.force};if(t.dryRun){d({command:`cf magic-cloud-networking on-ramps delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/onramps/${t[`onramp-id`]==null?`<onramp-id>`:encodeURIComponent(String(t[`onramp-id`]))}`,pathParams:{"onramp-id":String(t[`onramp-id`]??``)},query:n,bodyKind:`none`});return}let a=await o(t),s=t.local?m:await i(a);if(t.accountId=s,!await r({force:!!t.force})){process.stderr.write(`Aborted.
5
5
  `);return}u(await f(`Deleting`,async()=>a.magicCloudNetworking.onRamps.delete({account_id:s,onramp_id:t[`onramp-id`],...n})),{successLabel:`Deleted`})}};function he(e){return e.positional(`onramp-id`,{type:`string`,description:`Onramp ID`,demandOption:!0}).option(`attached-hubs`,{type:`string`,array:!0,description:`The attached_hubs field`}).option(`attached-vpcs`,{type:`string`,array:!0,description:`The attached_vpcs field`}).option(`description`,{type:`string`,description:`The description field`}).option(`install-routes-in-cloud`,{type:`boolean`,description:`The install_routes_in_cloud field`}).option(`install-routes-in-magic-wan`,{type:`boolean`,description:`The install_routes_in_magic_wan field`}).option(`manage-hub-to-hub-attachments`,{type:`boolean`,description:`The manage_hub_to_hub_attachments field`}).option(`manage-vpc-to-hub-attachments`,{type:`boolean`,description:`The manage_vpc_to_hub_attachments field`}).option(`name`,{type:`string`,description:`The name field`}).option(`vpc`,{type:`string`,description:`The vpc 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 ge={command:`edit <onramp-id>`,describe:`Update an On-ramp (Closed Beta).`,builder:he,handler:async t=>{if(t.dryRun){d({command:`cf magic-cloud-networking on-ramps edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/onramps/${t[`onramp-id`]==null?`<onramp-id>`:encodeURIComponent(String(t[`onramp-id`]))}`,pathParams:{"onramp-id":String(t[`onramp-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({attached_hubs:t[`attached-hubs`],attached_vpcs:t[`attached-vpcs`],description:p(t.description,`description`,`text`),install_routes_in_cloud:t[`install-routes-in-cloud`],install_routes_in_magic_wan:t[`install-routes-in-magic-wan`],manage_hub_to_hub_attachments:t[`manage-hub-to-hub-attachments`],manage_vpc_to_hub_attachments:t[`manage-vpc-to-hub-attachments`],name:p(t.name,`name`,`text`),vpc:p(t.vpc,`vpc`,`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.magicCloudNetworking.onRamps.edit({body:e,account_id:r,onramp_id:t[`onramp-id`]})),{successLabel:`Updated`});return}let a=l({attached_hubs:t[`attached-hubs`],attached_vpcs:t[`attached-vpcs`],description:p(t.description,`description`,`text`),install_routes_in_cloud:t[`install-routes-in-cloud`],install_routes_in_magic_wan:t[`install-routes-in-magic-wan`],manage_hub_to_hub_attachments:t[`manage-hub-to-hub-attachments`],manage_vpc_to_hub_attachments:t[`manage-vpc-to-hub-attachments`],name:p(t.name,`name`,`text`),vpc:p(t.vpc,`vpc`,`text`)});u(await f(`Updating`,async()=>n.magicCloudNetworking.onRamps.edit({body:a,account_id:r,onramp_id:t[`onramp-id`]})),{successLabel:`Updated`})}};function _e(e){return e.positional(`onramp-id`,{type:`string`,description:`Onramp ID`,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 ve={command:`export <onramp-id>`,describe:`Export an On-ramp to terraform ready file(s) (Closed Beta).`,builder:_e,handler:async t=>{if(t.dryRun){d({command:`cf magic-cloud-networking on-ramps export`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/onramps/${t[`onramp-id`]==null?`<onramp-id>`:encodeURIComponent(String(t[`onramp-id`]))}/export`,pathParams:{"onramp-id":String(t[`onramp-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}/magic/cloud/onramps/${encodeURIComponent(String(t[`onramp-id`]))}/export`,{method:`POST`,localEndpoint:t.local?t.localEndpoint:void 0}));g(t.text===!0?a.toString(`utf-8`):a)}};function ye(e){return e.positional(`onramp-id`,{type:`string`,description:`Onramp ID`,demandOption:!0}).option(`status`,{type:`boolean`,description:`Status`}).option(`vpcs`,{type:`boolean`,description:`Vpcs`}).option(`post-apply-resources`,{type:`boolean`,description:`Post apply resources`}).option(`planned-resources`,{type:`boolean`,description:`Planned resources`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const be={command:`get <onramp-id>`,describe:`Read an On-ramp (Closed Beta).`,builder:ye,handler:async t=>{let n={status:t.status,vpcs:t.vpcs,post_apply_resources:t[`post-apply-resources`],planned_resources:t[`planned-resources`]};if(t.dryRun){d({command:`cf magic-cloud-networking on-ramps get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/onramps/${t[`onramp-id`]==null?`<onramp-id>`:encodeURIComponent(String(t[`onramp-id`]))}`,pathParams:{"onramp-id":String(t[`onramp-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.magicCloudNetworking.onRamps.get({account_id:a,onramp_id:t[`onramp-id`],...n})),{successLabel:`Loaded`})}};function xe(e){return e.option(`order-by`,{type:`string`,description:`One of ["updated_at", "id", "cloud_type", "name"].`}).option(`desc`,{type:`boolean`,description:`Desc`}).option(`status`,{type:`boolean`,description:`Status`}).option(`vpcs`,{type:`boolean`,description:`Vpcs`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Se={command:`list`,describe:`List On-ramps (Closed Beta).`,builder:xe,handler:async t=>{let n={order_by:t[`order-by`],desc:t.desc,status:t.status,vpcs:t.vpcs};if(t.dryRun){d({command:`cf magic-cloud-networking on-ramps list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/onramps`,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.magicCloudNetworking.onRamps.list({account_id:a,...n})),{successLabel:`Loaded`})}};function Ce(e){return e.positional(`onramp-id`,{type:`string`,description:`Onramp ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const we={command:`plan <onramp-id>`,describe:`Plan an On-ramp (Closed Beta).`,builder:Ce,handler:async t=>{if(t.dryRun){d({command:`cf magic-cloud-networking on-ramps plan`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/onramps/${t[`onramp-id`]==null?`<onramp-id>`:encodeURIComponent(String(t[`onramp-id`]))}/plan`,pathParams:{"onramp-id":String(t[`onramp-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.magicCloudNetworking.onRamps.plan({account_id:r,onramp_id:t[`onramp-id`]})),{successLabel:`Created`})}};function Te(e){return e.positional(`onramp-id`,{type:`string`,description:`Onramp ID`,demandOption:!0}).option(`attached-hubs`,{type:`string`,array:!0,description:`The attached_hubs field`}).option(`attached-vpcs`,{type:`string`,array:!0,description:`The attached_vpcs field`}).option(`description`,{type:`string`,description:`The description field`}).option(`install-routes-in-cloud`,{type:`boolean`,description:`The install_routes_in_cloud field`}).option(`install-routes-in-magic-wan`,{type:`boolean`,description:`The install_routes_in_magic_wan field`}).option(`manage-hub-to-hub-attachments`,{type:`boolean`,description:`The manage_hub_to_hub_attachments field`}).option(`manage-vpc-to-hub-attachments`,{type:`boolean`,description:`The manage_vpc_to_hub_attachments field`}).option(`name`,{type:`string`,description:`The name field`}).option(`vpc`,{type:`string`,description:`The vpc 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 Ee={command:`update <onramp-id>`,describe:`Update an On-ramp (Closed Beta).`,builder:Te,handler:async t=>{if(t.dryRun){d({command:`cf magic-cloud-networking on-ramps update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/onramps/${t[`onramp-id`]==null?`<onramp-id>`:encodeURIComponent(String(t[`onramp-id`]))}`,pathParams:{"onramp-id":String(t[`onramp-id`]??``)},bodyKind:`json`,body:t.body===void 0?l({attached_hubs:t[`attached-hubs`],attached_vpcs:t[`attached-vpcs`],description:p(t.description,`description`,`text`),install_routes_in_cloud:t[`install-routes-in-cloud`],install_routes_in_magic_wan:t[`install-routes-in-magic-wan`],manage_hub_to_hub_attachments:t[`manage-hub-to-hub-attachments`],manage_vpc_to_hub_attachments:t[`manage-vpc-to-hub-attachments`],name:p(t.name,`name`,`text`),vpc:p(t.vpc,`vpc`,`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.magicCloudNetworking.onRamps.update({body:e,account_id:r,onramp_id:t[`onramp-id`]})),{successLabel:`Updated`});return}let a=l({attached_hubs:t[`attached-hubs`],attached_vpcs:t[`attached-vpcs`],description:p(t.description,`description`,`text`),install_routes_in_cloud:t[`install-routes-in-cloud`],install_routes_in_magic_wan:t[`install-routes-in-magic-wan`],manage_hub_to_hub_attachments:t[`manage-hub-to-hub-attachments`],manage_vpc_to_hub_attachments:t[`manage-vpc-to-hub-attachments`],name:p(t.name,`name`,`text`),vpc:p(t.vpc,`vpc`,`text`)});u(await f(`Updating`,async()=>n.magicCloudNetworking.onRamps.update({body:a,account_id:r,onramp_id:t[`onramp-id`]})),{successLabel:`Updated`})}},De={command:`on-ramps`,describe:`On-ramp connections that bridge cloud VPCs/VNets to your Cloudflare network`,builder:e=>e.command(ue).command(fe).command(me).command(ge).command(ve).command(be).command(Se).command(we).command(Ee).command(ce).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function $(e){return e.option(`provider-id`,{type:`string`,description:`Provider ID`}).option(`resource-type`,{type:`string`,description:`Resource type`}).option(`resource-id`,{type:`string`,description:`Resource ID`}).option(`region`,{type:`string`,description:`Region`}).option(`resource-group`,{type:`string`,description:`Resource group`}).option(`search`,{type:`string`,description:`Search`}).option(`order-by`,{type:`string`,description:`One of ["id", "resource_type", "region"].`}).option(`desc`,{type:`boolean`,description:`Desc`}).option(`v2`,{type:`boolean`,description:`V2`}).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 Oe={command:`export`,describe:`Export resources in the Resource Catalog as a JSON file (Closed Beta).`,builder:$,handler:async t=>{let n={provider_id:t[`provider-id`],resource_type:t[`resource-type`],resource_id:t[`resource-id`],region:t.region,resource_group:t[`resource-group`],search:t.search,order_by:t[`order-by`],desc:t.desc,v2:t.v2};if(t.dryRun){d({command:`cf magic-cloud-networking resources export`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/resources/export`,pathParams:{},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?m:await i(r);t.accountId=a;let s=new URLSearchParams(Object.entries(n).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),c=await f(`Loading`,async()=>_(`/accounts/${a}/magic/cloud/resources/export${s?`?`+s:``}`,{method:`GET`,localEndpoint:t.local?t.localEndpoint:void 0}));g(t.text===!0?c.toString(`utf-8`):c)}};function ke(e){return e.positional(`resource-id`,{type:`string`,description:`Resource ID`,demandOption:!0}).option(`v2`,{type:`boolean`,description:`V2`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ae={command:`get <resource-id>`,describe:`Read an resource from the Resource Catalog (Closed Beta).`,builder:ke,handler:async t=>{let n={v2:t.v2};if(t.dryRun){d({command:`cf magic-cloud-networking resources get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/resources/${t[`resource-id`]==null?`<resource-id>`:encodeURIComponent(String(t[`resource-id`]))}`,pathParams:{"resource-id":String(t[`resource-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.magicCloudNetworking.resources.get({account_id:a,resource_id:t[`resource-id`],...n})),{successLabel:`Loaded`})}};function je(e){return e.option(`provider-id`,{type:`string`,description:`Provider ID`}).option(`resource-type`,{type:`string`,description:`Resource type`}).option(`resource-id`,{type:`string`,description:`Resource ID`}).option(`region`,{type:`string`,description:`Region`}).option(`resource-group`,{type:`string`,description:`Resource group`}).option(`managed`,{type:`boolean`,description:`Managed`}).option(`search`,{type:`string`,description:`Search`}).option(`order-by`,{type:`string`,description:`One of ["id", "resource_type", "region"].`}).option(`desc`,{type:`boolean`,description:`Desc`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`page`,{type:`number`,description:`Page`}).option(`cloudflare`,{type:`boolean`,description:`Cloudflare`}).option(`v2`,{type:`boolean`,description:`V2`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Me={command:`list`,describe:`List resources in the Resource Catalog (Closed Beta).`,builder:h(je),handler:async t=>{let n={provider_id:t[`provider-id`],resource_type:t[`resource-type`],resource_id:t[`resource-id`],region:t.region,resource_group:t[`resource-group`],managed:t.managed,search:t.search,order_by:t[`order-by`],desc:t.desc,per_page:t[`per-page`],page:t.page,cloudflare:t.cloudflare,v2:t.v2};if(t.dryRun){d({command:`cf magic-cloud-networking resources list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/resources`,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.magicCloudNetworking.resources.list({account_id:a,...n})),{successLabel:`Loaded`})}};function Ne(e){return e.option(`policy`,{type:`string`,description:`The policy 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 Pe={command:`policy-preview`,describe:`Preview Rego query result against the latest resource catalog (Closed Beta).`,builder:Ne,handler:async n=>{if(n.dryRun){d({command:`cf magic-cloud-networking resources policy-preview`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/magic/cloud/resources/policy-preview`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({policy:p(n.policy,`policy`,`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.magicCloudNetworking.resources.policyPreview({...e,account_id:a})),{successLabel:`Created`});return}n.policy===void 0&&(n.policy=await t(`policy`,`The policy field`));let c=l({policy:p(n.policy,`policy`,`text`)});u(await f(`Creating`,async()=>r.magicCloudNetworking.resources.policyPreview({...c,account_id:a})),{successLabel:`Created`})}},Fe={command:`resources`,describe:`Discovered cloud resources (VPCs, subnets, route tables) from connected cloud accounts`,builder:e=>e.command(Oe).command(Ae).command(Me).command(Pe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ie={command:`magic-cloud-networking`,describe:`Multi-cloud networking — discover cloud resources, manage on-ramps, and automate cross-cloud connectivity`,builder:e=>e.command(N).command(Q).command(De).command(Fe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Ie as default};
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import{C as e,D as t,E as n,T as r,_ as i,n as a}from"./auth-ffdf9yR0.mjs";import{n as o,t as s}from"./body-parser-DKa8Ipg1.mjs";import{t as c}from"./output-BJFNwj7b.mjs";import{n as l,t as u}from"./progress-CrCGTq7N.mjs";import{n as d}from"./input-validation-zEO81MWN.mjs";import{t as f}from"./local-VJaJ3BZ1.mjs";function p(e){return e.option(`default-sampling`,{type:`number`,description:`Fallback sampling rate of flow messages being sent in packets per second. This should match the packet sampling rate configured on the router.`,default:1}).option(`name`,{type:`string`,description:`The account name.`}).option(`router-ips`,{type:`string`,array:!0,description:`The router_ips 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 m={command:`create`,describe:`Create a new network monitoring configuration.`,builder:p,handler:async n=>{if(n.dryRun){l({command:`cf magic-network-monitoring configs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/mnm/config`,pathParams:{},bodyKind:`json`,body:n.body===void 0?s({default_sampling:n[`default-sampling`],name:d(n.name,`name`,`text`),router_ips:n[`router-ips`]}):o(n.body)});return}let r=await a(n),p=n.local?f:await i(r);if(n.accountId=p,n.body){let e=o(n.body);c(await u(`Creating`,async()=>r.magicNetworkMonitoring.configs.create({...e,account_id:p})),{successLabel:`Created`});return}if(n[`default-sampling`]===void 0)throw Error(`--default-sampling is required (or pass --body with this field set).`);n.name===void 0&&(n.name=await t(`name`,`The account name.`));let m=s({default_sampling:n[`default-sampling`],name:d(n.name,`name`,`text`),router_ips:n[`router-ips`]});c(await u(`Creating`,async()=>r.magicNetworkMonitoring.configs.create({...m,account_id:p})),{successLabel:`Created`})}};function h(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 g={command:`delete`,describe:`Delete an existing network monitoring configuration.`,builder:h,handler:async t=>{if(t.dryRun){l({command:`cf magic-network-monitoring configs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/mnm/config`,pathParams:{},bodyKind:`none`});return}let n=await a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force})){process.stderr.write(`Aborted.
2
+ import{C as e,D as t,E as n,T as r,_ as i,n as a}from"./auth-BqDOIrKX.mjs";import{n as o,t as s}from"./body-parser-CBpeIUns.mjs";import{t as c}from"./output-CUxZRM5A.mjs";import{n as l,t as u}from"./progress-Cent9Lsg.mjs";import{n as d}from"./input-validation-CTqtyiY9.mjs";import{t as f}from"./local-D8bhHUMK.mjs";function p(e){return e.option(`default-sampling`,{type:`number`,description:`Fallback sampling rate of flow messages being sent in packets per second. This should match the packet sampling rate configured on the router.`,default:1}).option(`name`,{type:`string`,description:`The account name.`}).option(`router-ips`,{type:`string`,array:!0,description:`The router_ips 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 m={command:`create`,describe:`Create a new network monitoring configuration.`,builder:p,handler:async n=>{if(n.dryRun){l({command:`cf magic-network-monitoring configs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/mnm/config`,pathParams:{},bodyKind:`json`,body:n.body===void 0?s({default_sampling:n[`default-sampling`],name:d(n.name,`name`,`text`),router_ips:n[`router-ips`]}):o(n.body)});return}let r=await a(n),p=n.local?f:await i(r);if(n.accountId=p,n.body){let e=o(n.body);c(await u(`Creating`,async()=>r.magicNetworkMonitoring.configs.create({...e,account_id:p})),{successLabel:`Created`});return}if(n[`default-sampling`]===void 0)throw Error(`--default-sampling is required (or pass --body with this field set).`);n.name===void 0&&(n.name=await t(`name`,`The account name.`));let m=s({default_sampling:n[`default-sampling`],name:d(n.name,`name`,`text`),router_ips:n[`router-ips`]});c(await u(`Creating`,async()=>r.magicNetworkMonitoring.configs.create({...m,account_id:p})),{successLabel:`Created`})}};function h(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 g={command:`delete`,describe:`Delete an existing network monitoring configuration.`,builder:h,handler:async t=>{if(t.dryRun){l({command:`cf magic-network-monitoring configs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/mnm/config`,pathParams:{},bodyKind:`none`});return}let n=await a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force})){process.stderr.write(`Aborted.
3
3
  `);return}c(await u(`Deleting`,async()=>n.magicNetworkMonitoring.configs.delete({account_id:o})),{successLabel:`Deleted`})}};function _(e){return e.option(`default-sampling`,{type:`number`,description:`Fallback sampling rate of flow messages being sent in packets per second. This should match the packet sampling rate configured on the router.`}).option(`name`,{type:`string`,description:`The account name.`}).option(`router-ips`,{type:`string`,array:!0,description:`The router_ips 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 v={command:`edit`,describe:`Update fields in an existing network monitoring configuration.`,builder:_,handler:async t=>{if(t.dryRun){l({command:`cf magic-network-monitoring configs edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/mnm/config`,pathParams:{},bodyKind:`json`,body:t.body===void 0?s({default_sampling:t[`default-sampling`],name:d(t.name,`name`,`text`),router_ips:t[`router-ips`]}):o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Updating`,async()=>n.magicNetworkMonitoring.configs.edit({...e,account_id:r})),{successLabel:`Updated`});return}let p=s({default_sampling:t[`default-sampling`],name:d(t.name,`name`,`text`),router_ips:t[`router-ips`]});c(await u(`Updating`,async()=>n.magicNetworkMonitoring.configs.edit({...p,account_id:r})),{successLabel:`Updated`})}};function y(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`get`,describe:`Lists default sampling, router IPs, warp devices, and rules for account.`,builder:y,handler:async t=>{if(t.dryRun){l({command:`cf magic-network-monitoring configs full get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/mnm/config/full`,pathParams:{},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.magicNetworkMonitoring.configs.full.get({account_id:r})),{successLabel:`Loaded`})}},x={command:`full`,describe:`Account-level monitoring configuration — sampling rates, thresholds, and notification settings`,builder:e=>e.command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function S(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`get`,describe:`Lists default sampling, router IPs and warp devices for account.`,builder:S,handler:async t=>{if(t.dryRun){l({command:`cf magic-network-monitoring configs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/mnm/config`,pathParams:{},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.magicNetworkMonitoring.configs.get({account_id:r})),{successLabel:`Loaded`})}};function w(e){return e.option(`default-sampling`,{type:`number`,description:`Fallback sampling rate of flow messages being sent in packets per second. This should match the packet sampling rate configured on the router.`}).option(`name`,{type:`string`,description:`The account name.`}).option(`router-ips`,{type:`string`,array:!0,description:`The router_ips 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 T={command:`update`,describe:`Update an existing network monitoring configuration, requires the entire configuration to be updated at once.`,builder:w,handler:async n=>{if(n.dryRun){l({command:`cf magic-network-monitoring configs update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/mnm/config`,pathParams:{},bodyKind:`json`,body:n.body===void 0?s({default_sampling:n[`default-sampling`],name:d(n.name,`name`,`text`),router_ips:n[`router-ips`]}):o(n.body)});return}let r=await a(n),p=n.local?f:await i(r);if(n.accountId=p,n.body){let e=o(n.body);c(await u(`Updating`,async()=>r.magicNetworkMonitoring.configs.update({...e,account_id:p})),{successLabel:`Updated`});return}if(n[`default-sampling`]===void 0)throw Error(`--default-sampling is required (or pass --body with this field set).`);n.name===void 0&&(n.name=await t(`name`,`The account name.`));let m=s({default_sampling:n[`default-sampling`],name:d(n.name,`name`,`text`),router_ips:n[`router-ips`]});c(await u(`Updating`,async()=>r.magicNetworkMonitoring.configs.update({...m,account_id:p})),{successLabel:`Updated`})}},E={command:`configs`,describe:`Account-level monitoring configuration — sampling rates, thresholds, and notification settings`,builder:e=>e.command(m).command(g).command(v).command(C).command(T).command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function D(e){return e.positional(`rule-id`,{type:`string`,description:`The id of the rule. Must be unique.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const O={command:`edit <rule-id>`,describe:`Update advertisement for rule.`,builder:D,handler:async t=>{if(t.dryRun){l({command:`cf magic-network-monitoring rules advertisements edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/mnm/rules/${t[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(t[`rule-id`]))}/advertisement`,pathParams:{"rule-id":String(t[`rule-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Updating`,async()=>n.magicNetworkMonitoring.rules.advertisements.edit({account_id:r,rule_id:t[`rule-id`]})),{successLabel:`Updated`})}},k={command:`advertisements`,describe:`Monitoring rules that define traffic thresholds and trigger alerts or prefix advertisements`,builder:e=>e.command(O).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function A(e){return e.option(`automatic-advertisement`,{type:`boolean`,description:`Toggle on if you would like Cloudflare to automatically advertise the IP Prefixes within the rule via Magic Transit when the rule is triggered. Only available for users of Magic Transit.`}).option(`bandwidth-threshold`,{type:`number`,description:`The number of bits per second for the rule. When this value is exceeded for the set duration, an alert notification is sent. Minimum of 1 and no maximum.`}).option(`duration`,{type:`string`,description:`The amount of time that the rule threshold must be exceeded to send an alert notification. The final value must be equivalent to one of the following 8 values ["1m","5m","10m","15m","20m","30m","45m","60m"].`,choices:[`1m`,`5m`,`10m`,`15m`,`20m`,`30m`,`45m`,`60m`],default:`1m`}).option(`name`,{type:`string`,description:`The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9, underscore (_), dash (-), period (.), and tilde (~). You can’t have a space in the rule name. Max 256 characters.`}).option(`packet-threshold`,{type:`number`,description:`The number of packets per second for the rule. When this value is exceeded for the set duration, an alert notification is sent. Minimum of 1 and no maximum.`}).option(`prefix-match`,{type:`string`,description:`Prefix match type to be applied for a prefix auto advertisement when using an advanced_ddos rule.`,choices:[`exact`,`subnet`,`supernet`]}).option(`prefixes`,{type:`string`,array:!0,description:`The prefixes field`}).option(`type`,{type:`string`,description:`MNM rule type.`,choices:[`threshold`,`zscore`,`advanced_ddos`]}).option(`zscore-sensitivity`,{type:`string`,description:`Level of sensitivity set for zscore rules.`,choices:[`low`,`medium`,`high`]}).option(`zscore-target`,{type:`string`,description:`Target of the zscore rule analysis.`,choices:[`bits`,`packets`]}).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 j={command:`create`,describe:`Create network monitoring rules for account. Currently only supports creating a single rule per API request.`,builder:A,handler:async r=>{if(r.dryRun){l({command:`cf magic-network-monitoring rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/mnm/rules`,pathParams:{},bodyKind:`json`,body:r.body===void 0?s({automatic_advertisement:r[`automatic-advertisement`],bandwidth_threshold:r[`bandwidth-threshold`],duration:d(r.duration,`duration`,`text`),name:d(r.name,`name`,`text`),packet_threshold:r[`packet-threshold`],prefix_match:d(r[`prefix-match`],`prefix-match`,`text`),prefixes:r.prefixes,type:d(r.type,`type`,`text`),zscore_sensitivity:d(r[`zscore-sensitivity`],`zscore-sensitivity`,`text`),zscore_target:d(r[`zscore-target`],`zscore-target`,`text`)}):o(r.body)});return}let p=await a(r),m=r.local?f:await i(p);if(r.accountId=m,r.body){let e=o(r.body);c(await u(`Creating`,async()=>p.magicNetworkMonitoring.rules.create({body:e,account_id:m})),{successLabel:`Created`});return}if(r[`automatic-advertisement`]===void 0)throw Error(`--automatic-advertisement is required (or pass --body with this field set).`);if(r.name===void 0&&(r.name=await t(`name`,`The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9, underscore (_), dash (-), period (.), and tilde (~). You can’t have a space in the rule name. Max 256 characters.`)),r.prefixes===void 0)throw Error(`--prefixes is required (or pass --body with this field set).`);r.type===void 0&&(r.type=await n(`type`,`MNM rule type.`,[`threshold`,`zscore`,`advanced_ddos`]));let h=s({automatic_advertisement:r[`automatic-advertisement`],bandwidth_threshold:r[`bandwidth-threshold`],duration:d(r.duration,`duration`,`text`),name:d(r.name,`name`,`text`),packet_threshold:r[`packet-threshold`],prefix_match:d(r[`prefix-match`],`prefix-match`,`text`),prefixes:r.prefixes,type:d(r.type,`type`,`text`),zscore_sensitivity:d(r[`zscore-sensitivity`],`zscore-sensitivity`,`text`),zscore_target:d(r[`zscore-target`],`zscore-target`,`text`)});c(await u(`Creating`,async()=>p.magicNetworkMonitoring.rules.create({body:h,account_id:m})),{successLabel:`Created`})}};function M(e){return e.positional(`rule-id`,{type:`string`,description:`The id of the rule. Must be unique.`,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 N={command:`delete <rule-id>`,describe:`Delete a network monitoring rule for account.`,builder:M,handler:async t=>{if(t.dryRun){l({command:`cf magic-network-monitoring rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/mnm/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 a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force})){process.stderr.write(`Aborted.
4
4
  `);return}c(await u(`Deleting`,async()=>n.magicNetworkMonitoring.rules.delete({account_id:o,rule_id:t[`rule-id`]})),{successLabel:`Deleted`})}};function P(e){return e.positional(`rule-id`,{type:`string`,description:`The id of the rule. Must be unique.`,demandOption:!0}).option(`automatic-advertisement`,{type:`boolean`,description:`Toggle on if you would like Cloudflare to automatically advertise the IP Prefixes within the rule via Magic Transit when the rule is triggered. Only available for users of Magic Transit.`}).option(`bandwidth-threshold`,{type:`number`,description:`The number of bits per second for the rule. When this value is exceeded for the set duration, an alert notification is sent. Minimum of 1 and no maximum.`}).option(`duration`,{type:`string`,description:`The amount of time that the rule threshold must be exceeded to send an alert notification. The final value must be equivalent to one of the following 8 values ["1m","5m","10m","15m","20m","30m","45m","60m"].`,choices:[`1m`,`5m`,`10m`,`15m`,`20m`,`30m`,`45m`,`60m`]}).option(`name`,{type:`string`,description:`The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9, underscore (_), dash (-), period (.), and tilde (~). You can’t have a space in the rule name. Max 256 characters.`}).option(`packet-threshold`,{type:`number`,description:`The number of packets per second for the rule. When this value is exceeded for the set duration, an alert notification is sent. Minimum of 1 and no maximum.`}).option(`prefix-match`,{type:`string`,description:`Prefix match type to be applied for a prefix auto advertisement when using an advanced_ddos rule.`,choices:[`exact`,`subnet`,`supernet`]}).option(`prefixes`,{type:`string`,array:!0,description:`The prefixes field`}).option(`type`,{type:`string`,description:`MNM rule type.`,choices:[`threshold`,`zscore`,`advanced_ddos`]}).option(`zscore-sensitivity`,{type:`string`,description:`Level of sensitivity set for zscore rules.`,choices:[`low`,`medium`,`high`]}).option(`zscore-target`,{type:`string`,description:`Target of the zscore rule analysis.`,choices:[`bits`,`packets`]}).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 F={command:`edit <rule-id>`,describe:`Update a network monitoring rule for account.`,builder:P,handler:async r=>{if(r.dryRun){l({command:`cf magic-network-monitoring rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/mnm/rules/${r[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(r[`rule-id`]))}`,pathParams:{"rule-id":String(r[`rule-id`]??``)},bodyKind:`json`,body:r.body===void 0?s({automatic_advertisement:r[`automatic-advertisement`],bandwidth_threshold:r[`bandwidth-threshold`],duration:d(r.duration,`duration`,`text`),name:d(r.name,`name`,`text`),packet_threshold:r[`packet-threshold`],prefix_match:d(r[`prefix-match`],`prefix-match`,`text`),prefixes:r.prefixes,type:d(r.type,`type`,`text`),zscore_sensitivity:d(r[`zscore-sensitivity`],`zscore-sensitivity`,`text`),zscore_target:d(r[`zscore-target`],`zscore-target`,`text`)}):o(r.body)});return}let p=await a(r),m=r.local?f:await i(p);if(r.accountId=m,r.body){let e=o(r.body);c(await u(`Updating`,async()=>p.magicNetworkMonitoring.rules.edit({body:e,account_id:m,rule_id:r[`rule-id`]})),{successLabel:`Updated`});return}if(r[`automatic-advertisement`]===void 0)throw Error(`--automatic-advertisement is required (or pass --body with this field set).`);if(r.name===void 0&&(r.name=await t(`name`,`The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9, underscore (_), dash (-), period (.), and tilde (~). You can’t have a space in the rule name. Max 256 characters.`)),r.prefixes===void 0)throw Error(`--prefixes is required (or pass --body with this field set).`);r.type===void 0&&(r.type=await n(`type`,`MNM rule type.`,[`threshold`,`zscore`,`advanced_ddos`]));let h=s({automatic_advertisement:r[`automatic-advertisement`],bandwidth_threshold:r[`bandwidth-threshold`],duration:d(r.duration,`duration`,`text`),name:d(r.name,`name`,`text`),packet_threshold:r[`packet-threshold`],prefix_match:d(r[`prefix-match`],`prefix-match`,`text`),prefixes:r.prefixes,type:d(r.type,`type`,`text`),zscore_sensitivity:d(r[`zscore-sensitivity`],`zscore-sensitivity`,`text`),zscore_target:d(r[`zscore-target`],`zscore-target`,`text`)});c(await u(`Updating`,async()=>p.magicNetworkMonitoring.rules.edit({body:h,account_id:m,rule_id:r[`rule-id`]})),{successLabel:`Updated`})}};function I(e){return e.positional(`rule-id`,{type:`string`,description:`The id of the rule. Must be unique.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const L={command:`get <rule-id>`,describe:`List a single network monitoring rule for account.`,builder:I,handler:async t=>{if(t.dryRun){l({command:`cf magic-network-monitoring rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/mnm/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 a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.magicNetworkMonitoring.rules.get({account_id:r,rule_id:t[`rule-id`]})),{successLabel:`Loaded`})}};function R(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const z={command:`list`,describe:`Lists network monitoring rules for account.`,builder:R,handler:async t=>{if(t.dryRun){l({command:`cf magic-network-monitoring rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/mnm/rules`,pathParams:{},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.magicNetworkMonitoring.rules.list({account_id:r})),{successLabel:`Loaded`})}};function B(e){return e.option(`automatic-advertisement`,{type:`boolean`,description:`Toggle on if you would like Cloudflare to automatically advertise the IP Prefixes within the rule via Magic Transit when the rule is triggered. Only available for users of Magic Transit.`}).option(`bandwidth-threshold`,{type:`number`,description:`The number of bits per second for the rule. When this value is exceeded for the set duration, an alert notification is sent. Minimum of 1 and no maximum.`}).option(`duration`,{type:`string`,description:`The amount of time that the rule threshold must be exceeded to send an alert notification. The final value must be equivalent to one of the following 8 values ["1m","5m","10m","15m","20m","30m","45m","60m"].`,choices:[`1m`,`5m`,`10m`,`15m`,`20m`,`30m`,`45m`,`60m`]}).option(`name`,{type:`string`,description:`The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9, underscore (_), dash (-), period (.), and tilde (~). You can’t have a space in the rule name. Max 256 characters.`}).option(`packet-threshold`,{type:`number`,description:`The number of packets per second for the rule. When this value is exceeded for the set duration, an alert notification is sent. Minimum of 1 and no maximum.`}).option(`prefix-match`,{type:`string`,description:`Prefix match type to be applied for a prefix auto advertisement when using an advanced_ddos rule.`,choices:[`exact`,`subnet`,`supernet`]}).option(`prefixes`,{type:`string`,array:!0,description:`The prefixes field`}).option(`type`,{type:`string`,description:`MNM rule type.`,choices:[`threshold`,`zscore`,`advanced_ddos`]}).option(`zscore-sensitivity`,{type:`string`,description:`Level of sensitivity set for zscore rules.`,choices:[`low`,`medium`,`high`]}).option(`zscore-target`,{type:`string`,description:`Target of the zscore rule analysis.`,choices:[`bits`,`packets`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const V={command:`update`,describe:`Update network monitoring rules for account.`,builder:B,handler:async r=>{if(r.dryRun){l({command:`cf magic-network-monitoring rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/mnm/rules`,pathParams:{},bodyKind:`json`,body:r.body===void 0?s({automatic_advertisement:r[`automatic-advertisement`],bandwidth_threshold:r[`bandwidth-threshold`],duration:d(r.duration,`duration`,`text`),name:d(r.name,`name`,`text`),packet_threshold:r[`packet-threshold`],prefix_match:d(r[`prefix-match`],`prefix-match`,`text`),prefixes:r.prefixes,type:d(r.type,`type`,`text`),zscore_sensitivity:d(r[`zscore-sensitivity`],`zscore-sensitivity`,`text`),zscore_target:d(r[`zscore-target`],`zscore-target`,`text`)}):o(r.body)});return}let p=await a(r),m=r.local?f:await i(p);if(r.accountId=m,r.body){let e=o(r.body);c(await u(`Updating`,async()=>p.magicNetworkMonitoring.rules.update({body:e,account_id:m})),{successLabel:`Updated`});return}if(r[`automatic-advertisement`]===void 0)throw Error(`--automatic-advertisement is required (or pass --body with this field set).`);if(r.name===void 0&&(r.name=await t(`name`,`The name of the rule. Must be unique. Supports characters A-Z, a-z, 0-9, underscore (_), dash (-), period (.), and tilde (~). You can’t have a space in the rule name. Max 256 characters.`)),r.prefixes===void 0)throw Error(`--prefixes is required (or pass --body with this field set).`);r.type===void 0&&(r.type=await n(`type`,`MNM rule type.`,[`threshold`,`zscore`,`advanced_ddos`]));let h=s({automatic_advertisement:r[`automatic-advertisement`],bandwidth_threshold:r[`bandwidth-threshold`],duration:d(r.duration,`duration`,`text`),name:d(r.name,`name`,`text`),packet_threshold:r[`packet-threshold`],prefix_match:d(r[`prefix-match`],`prefix-match`,`text`),prefixes:r.prefixes,type:d(r.type,`type`,`text`),zscore_sensitivity:d(r[`zscore-sensitivity`],`zscore-sensitivity`,`text`),zscore_target:d(r[`zscore-target`],`zscore-target`,`text`)});c(await u(`Updating`,async()=>p.magicNetworkMonitoring.rules.update({body:h,account_id:m})),{successLabel:`Updated`})}},H={command:`rules`,describe:`Monitoring rules that define traffic thresholds and trigger alerts or prefix advertisements`,builder:e=>e.command(j).command(N).command(F).command(L).command(z).command(V).command(k).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function U(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const W={command:`create`,describe:`Generate authentication token for VPC flow logs export.`,builder:U,handler:async t=>{if(t.dryRun){l({command:`cf magic-network-monitoring vpc-flows tokens create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/mnm/vpc-flows/token`,pathParams:{},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Creating`,async()=>n.magicNetworkMonitoring.vpcFlows.tokens.create({account_id:r})),{successLabel:`Created`})}},G={command:`tokens`,describe:`Ingest VPC flow logs from cloud providers for network visibility and anomaly detection`,builder:e=>e.command(W).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},K={command:`vpc-flows`,describe:`Operations for vpc-flows`,builder:e=>e.command(G).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},q={command:`magic-network-monitoring`,describe:`Flow-based network traffic monitoring with configurable alerting rules and VPC flow ingestion`,builder:e=>e.command(E).command(H).command(K).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{q as default};