cf 0.0.6 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -4
- package/bin/cf +11 -0
- package/dist/_meta/agent-context.json +89 -89
- package/dist/_meta/commands.json +12866 -4982
- package/dist/_meta/schemas.json +33572 -1148
- package/dist/abuse-reports-KtfZhi6j.mjs +8 -0
- package/dist/accounts-BopMfODC.mjs +21 -0
- package/dist/acm-BT4vlnEJ.mjs +3 -0
- package/dist/addressing-B3uFxHst.mjs +13 -0
- package/dist/{agent-context-BBJnI_Q7.mjs → agent-context-D26woB9J.mjs} +1 -1
- package/dist/ai-DWHqwMap.mjs +2 -0
- package/dist/ai-gateway-CbKEO-3o.mjs +8 -0
- package/dist/ai-search-VnOQ5n--.mjs +7 -0
- package/dist/alerting-BmmgIlIO.mjs +6 -0
- package/dist/analytics-isY03taL.mjs +20 -0
- package/dist/api-gateway-DXurEbA-.mjs +33 -0
- package/dist/argo-B02BL_hp.mjs +2 -0
- package/dist/audit-logs-DcgR9xUc.mjs +2 -0
- package/dist/auth-CQcAgnOy.mjs +135 -0
- package/dist/auth-DenWm_X0.mjs +6 -0
- package/dist/autorag-CmrwnGVj.mjs +2 -0
- package/dist/billing-CaW1ZAB1.mjs +2 -0
- package/dist/body-parser-Br-BoYk-.mjs +2 -0
- package/dist/bot-management-CeBsFx68.mjs +5 -0
- package/dist/botnet-feed-B396vQeQ.mjs +3 -0
- package/dist/brand-protection-D4V1v5Kl.mjs +3 -0
- package/dist/browser-rendering-GF7rNtKI.mjs +4 -0
- package/dist/build-5jmmOZhm.mjs +1054 -0
- package/dist/{builds-B5sC8Gh_.mjs → builds-C_ySULja.mjs} +1 -1
- package/dist/cache-DmXizSMi.mjs +5 -0
- package/dist/calls-x4KQpTB4.mjs +4 -0
- package/dist/certificate-authorities-hC0SG-Ga.mjs +2 -0
- package/dist/chunk-DH-VkVmc.mjs +2 -0
- package/dist/client-certificates-BGVsDyeJ.mjs +3 -0
- package/dist/cloud-connector-BClQpEzI.mjs +2 -0
- package/dist/cloudforce-one-BfhFrO6M.mjs +21 -0
- package/dist/{completions-BSRqbcrz.mjs → completions-BKrxcfhN.mjs} +1 -1
- package/dist/config-DYzlVxcB.mjs +2 -0
- package/dist/connectivity-G0NP6LtW.mjs +3 -0
- package/dist/content-scanning-DEtPJ7aF.mjs +4 -0
- package/dist/context-CC0Rhkhy.mjs +2 -0
- package/dist/custom-certificates-rJXFpUWu.mjs +5 -0
- package/dist/custom-hostnames-Be5mgLeF.mjs +5 -0
- package/dist/custom-nameservers-CoFdy6hD.mjs +3 -0
- package/dist/custom-pages-D-oErw57.mjs +4 -0
- package/dist/d1-C95ckPKI.mjs +3 -0
- package/dist/dcv-delegation-CWSkbGuc.mjs +2 -0
- package/dist/delegate.mjs +2 -0
- package/dist/deploy-DbkiIzUr.mjs +2 -0
- package/dist/dev-C6iSuQZm.mjs +6 -0
- package/dist/diagnostics-DEEhPnXj.mjs +3 -0
- package/dist/dispatch-namespaces-BzXeV7PH.mjs +7 -0
- package/dist/dist-CnSubA1Z.mjs +82 -0
- package/dist/dist-DNBSHor6.mjs +301 -0
- package/dist/dns-firewall-BQXD_NxG.mjs +57 -0
- package/dist/dns-qW-3TZOT.mjs +29 -0
- package/dist/durable-objects-CgWFYEJJ.mjs +2 -0
- package/dist/email-routing-tdNJaCpJ.mjs +10 -0
- package/dist/email-security-DTVHNr2h.mjs +60 -0
- package/dist/email-sending-DsFTvE31.mjs +3 -0
- package/dist/filters-DO1Is_tI.mjs +4 -0
- package/dist/firewall-DbUhVTCg.mjs +11 -0
- package/dist/fraud-Bzr4njYb.mjs +8 -0
- package/dist/google-tag-gateway-BQxkA90M.mjs +2 -0
- package/dist/healthchecks-BBAs-lS_.mjs +4 -0
- package/dist/hostnames-Dz9PEUKS.mjs +3 -0
- package/dist/hyperdrive-B1iUJddG.mjs +18 -0
- package/dist/iam-CJM8gHpG.mjs +6 -0
- package/dist/images-DEoBmtFS.mjs +5 -0
- package/dist/index.mjs +1 -1
- package/dist/input-validation-zEO81MWN.mjs +2 -0
- package/dist/intel-BM6xkZ0C.mjs +3 -0
- package/dist/ips-B8fwxKZD.mjs +2 -0
- package/dist/keyless-certificates-DffYnd4b.mjs +3 -0
- package/dist/kv-BTceLtWZ.mjs +5 -0
- package/dist/leaked-credential-checks-CALfvoCo.mjs +3 -0
- package/dist/lib-Eu1wXxuh.mjs +68 -0
- package/dist/load-balancers-C1Ho1gCF.mjs +6 -0
- package/dist/local-VJaJ3BZ1.mjs +2 -0
- package/dist/logpush-CSYhgevA.mjs +4 -0
- package/dist/logs-DlIwmMpt.mjs +3 -0
- package/dist/magic-cloud-networking-Czu0pZ0a.mjs +5 -0
- package/dist/magic-network-monitoring-d7GJE5Yt.mjs +4 -0
- package/dist/magic-transit-qQmA-981.mjs +89 -0
- package/dist/managed-transforms-Dd6AnbWE.mjs +3 -0
- package/dist/mtls-certificates-C0rlCRGs.mjs +3 -0
- package/dist/network-interconnects-CxG2deY0.mjs +36 -0
- package/dist/organizations-DyEAiGiR.mjs +41 -0
- package/dist/origin-ca-certificates-S8RcoMF6.mjs +3 -0
- package/dist/origin-post-quantum-encryption-B8ZcpLu5.mjs +2 -0
- package/dist/origin-tls-client-auth-BlxMmQrE.mjs +5 -0
- package/dist/{output-CqGQp2r6.mjs → output-D7_yAFVR.mjs} +1 -1
- package/dist/page-rules-DP-w6TAm.mjs +18 -0
- package/dist/page-shield-Bf7kFp8c.mjs +37 -0
- package/dist/pages-D0Y_XRqW.mjs +10 -0
- package/dist/pipelines-C-SPESAk.mjs +6 -0
- package/dist/progress-CjcQ6ato.mjs +2 -0
- package/dist/queues-wv6CZsi8.mjs +6 -0
- package/dist/r2-DuXjp9n5.mjs +21 -0
- package/dist/r2-data-catalog-DQCMrmNO.mjs +14 -0
- package/dist/radar-BW_ZHP8X.mjs +2 -0
- package/dist/rate-limits-DLTkIvwr.mjs +5 -0
- package/dist/raw-fetch-hRv-6P3D.mjs +2 -0
- package/dist/realtime-kit-Ch7Vg3vj.mjs +6 -0
- package/dist/registrar-DIIv6fWd.mjs +46 -0
- package/dist/request-tracers-DMej0Drs.mjs +2 -0
- package/dist/resolve-BuJRWSk0.mjs +2 -0
- package/dist/resource-sharing-CYJ7cMWq.mjs +5 -0
- package/dist/resource-tagging-Dnz65MgH.mjs +16 -0
- package/dist/rules-DLJpOYbC.mjs +4 -0
- package/dist/rulesets-D9nqEJT5.mjs +8 -0
- package/dist/rum-DBVmdPkp.mjs +4 -0
- package/dist/{schema-qJlCfmo8.mjs → schema-CHBfkARI.mjs} +1 -1
- package/dist/schema-validation-MCd3xdtX.mjs +4 -0
- package/dist/scim-DZA3VXog.mjs +3 -0
- package/dist/{scm-C872x0C2.mjs → scm-CilfPOue.mjs} +1 -1
- package/dist/secrets-store-BrvcZSOM.mjs +21 -0
- package/dist/security-center-BU6f3Cm1.mjs +2 -0
- package/dist/security-txt-BPIbP3dG.mjs +3 -0
- package/dist/session-H7IV2BrM.mjs +2 -0
- package/dist/shared-DEzmTsEC.mjs +2 -0
- package/dist/smart-shield-e8XFBkiF.mjs +3 -0
- package/dist/snippets-B4M3MMb8.mjs +4 -0
- package/dist/spawn-13QQ0IwO.mjs +10 -0
- package/dist/spectrum-B0adfSRI.mjs +59 -0
- package/dist/speed-BVcUtkAz.mjs +4 -0
- package/dist/src-B9cKsgsg.mjs +108 -0
- package/dist/ssl-BAa91gsc.mjs +15 -0
- package/dist/stream-D53sxKb3.mjs +14 -0
- package/dist/tenants-bH5pt3dJ.mjs +2 -0
- package/dist/{theme-BKCxTQTe.mjs → theme-BklJDrb2.mjs} +2 -2
- package/dist/token-validation-M61Vx_Tw.mjs +4 -0
- package/dist/{tools-CawscCBu.mjs → tools-B7QiNu-d.mjs} +1 -1
- package/dist/turnstile-wAU0Gc2Z.mjs +23 -0
- package/dist/{ui-Dj3No2vN.mjs → ui-BXjU1dX1.mjs} +1 -1
- package/dist/url-normalization-DZrWDgB5.mjs +3 -0
- package/dist/url-scanner-Zo49edNp.mjs +2 -0
- package/dist/user-DbXlVReB.mjs +10 -0
- package/dist/vectorize-CUnTM0DT.mjs +4 -0
- package/dist/versions-DzyrlUAi.mjs +2 -0
- package/dist/{vuln-scanner-B1VwCIko.mjs → vuln-scanner-Br_2lQp1.mjs} +1 -1
- package/dist/waiting-rooms-BZW0X69-.mjs +11 -0
- package/dist/web3-DueyOQtx.mjs +4 -0
- package/dist/workers-builds-BM_aoeUR.mjs +7 -0
- package/dist/workers-nV_vBCfV.mjs +16 -0
- package/dist/workflows-CQITmo-s.mjs +4 -0
- package/dist/zaraz-DIbpF5Op.mjs +2 -0
- package/dist/zero-trust-CKp8j512.mjs +119 -0
- package/dist/zones-BZ5tZDbH.mjs +28 -0
- package/package.json +13 -3
- package/dist/abuse-reports-DR0yMg-Q.mjs +0 -2
- package/dist/accounts-BjGtCB8T.mjs +0 -6
- package/dist/acm-h4YPDN7k.mjs +0 -3
- package/dist/addressing-BiEnQ1o1.mjs +0 -11
- package/dist/ai-BPln2Yka.mjs +0 -2
- package/dist/ai-gateway-DgD9nKyd.mjs +0 -8
- package/dist/ai-search-EjrONI5a.mjs +0 -7
- package/dist/alerting-CPWMKr-m.mjs +0 -6
- package/dist/analytics-3dX9-scQ.mjs +0 -2
- package/dist/api-gateway-7FKFHdI-.mjs +0 -9
- package/dist/argo-Dxz9P37E.mjs +0 -2
- package/dist/audit-logs-D_Xw5x8Y.mjs +0 -2
- package/dist/auth-BHD_B2p9.mjs +0 -277
- package/dist/auth-caVo2j1K.mjs +0 -6
- package/dist/autorag-D7nMweNF.mjs +0 -2
- package/dist/billing-yaIBp1Xq.mjs +0 -2
- package/dist/body-parser-iA3vRFmh.mjs +0 -2
- package/dist/bot-management-C0H6U0t4.mjs +0 -2
- package/dist/botnet-feed-BXV9GVwF.mjs +0 -3
- package/dist/brand-protection-CI0NQa_l.mjs +0 -3
- package/dist/browser-rendering-DnKNRJJe.mjs +0 -4
- package/dist/cache-B6M_pm_D.mjs +0 -5
- package/dist/calls-C5XCC0i1.mjs +0 -4
- package/dist/certificate-authorities-BQuHL4dm.mjs +0 -2
- package/dist/client-certificates-CwpzEnCT.mjs +0 -3
- package/dist/cloud-connector-CU3PLNLe.mjs +0 -2
- package/dist/cloudforce-one-DzrArr1o.mjs +0 -21
- package/dist/config-BmTd_qeU.mjs +0 -2
- package/dist/connectivity-C4tXPkW_.mjs +0 -3
- package/dist/content-scanning-CH_YXdlZ.mjs +0 -4
- package/dist/context-6lBIck1r.mjs +0 -2
- package/dist/custom-certificates-pllRyU2y.mjs +0 -3
- package/dist/custom-hostnames-GmF0DfYA.mjs +0 -5
- package/dist/custom-nameservers-DPVHUlUQ.mjs +0 -3
- package/dist/custom-pages-XWwfn7hV.mjs +0 -4
- package/dist/d1-c_zhZGWf.mjs +0 -3
- package/dist/dcv-delegation-pXpU48A8.mjs +0 -2
- package/dist/dev-Bu26u5Jm.mjs +0 -14
- package/dist/diagnostics-BU07Jnku.mjs +0 -3
- package/dist/dispatch-namespaces-D_Kq_2gX.mjs +0 -7
- package/dist/dns-CrvIxztB.mjs +0 -11
- package/dist/dns-firewall-CLtGAQ9x.mjs +0 -3
- package/dist/dry-run-FV0pZwdg.mjs +0 -2
- package/dist/durable-objects-Y5rLFSQX.mjs +0 -2
- package/dist/email-routing-CxU5JlXT.mjs +0 -10
- package/dist/email-security-CnpAHWpj.mjs +0 -8
- package/dist/email-sending-MeCKsktR.mjs +0 -3
- package/dist/filters-Sx2Po1UP.mjs +0 -4
- package/dist/firewall-B0_012XO.mjs +0 -9
- package/dist/fraud-CG0G_VG-.mjs +0 -2
- package/dist/google-tag-gateway-BLbj1y3h.mjs +0 -2
- package/dist/healthchecks-C0LgExxa.mjs +0 -4
- package/dist/hostnames-D4K6s9EX.mjs +0 -3
- package/dist/hyperdrive-D7XvTRys.mjs +0 -3
- package/dist/iam-4LhJianW.mjs +0 -6
- package/dist/images-BqXyIycX.mjs +0 -5
- package/dist/input-validation-BpVQi9rR.mjs +0 -2
- package/dist/intel-CiO3Sy4x.mjs +0 -3
- package/dist/ips-DLuGN7Mr.mjs +0 -2
- package/dist/keyless-certificates-x-87T5SM.mjs +0 -3
- package/dist/kv-CVYCrk7L.mjs +0 -5
- package/dist/leaked-credential-checks-FvhVCL23.mjs +0 -3
- package/dist/load-balancers-cxodJuI2.mjs +0 -6
- package/dist/local-OqhVQbv0.mjs +0 -2
- package/dist/logpush-BX7z2xWz.mjs +0 -4
- package/dist/logs-C7vxr6Kp.mjs +0 -3
- package/dist/magic-cloud-networking-C3grROf-.mjs +0 -5
- package/dist/magic-network-monitoring-DiZ5ZXxh.mjs +0 -4
- package/dist/magic-transit-troGMFb9.mjs +0 -30
- package/dist/managed-transforms-B5w_LlVN.mjs +0 -3
- package/dist/mtls-certificates-C1S9MciH.mjs +0 -3
- package/dist/network-interconnects-CVSiv1fF.mjs +0 -4
- package/dist/organizations-BtlEchi-.mjs +0 -4
- package/dist/origin-ca-certificates-0XCi4dO6.mjs +0 -3
- package/dist/origin-post-quantum-encryption-CTvkdYDG.mjs +0 -2
- package/dist/origin-tls-client-auth-qAvRD1BQ.mjs +0 -5
- package/dist/page-rules-CcMmrvY4.mjs +0 -3
- package/dist/page-shield-Dxh4bJ-w.mjs +0 -3
- package/dist/pages-F1vdzqgC.mjs +0 -6
- package/dist/pipelines-DsF1HHMY.mjs +0 -6
- package/dist/progress-5sHFvwez.mjs +0 -2
- package/dist/queues-BuvkxFPX.mjs +0 -6
- package/dist/r2-Du-fgHiT.mjs +0 -9
- package/dist/r2-data-catalog-BUiMNSwc.mjs +0 -3
- package/dist/radar-C0eqNmWR.mjs +0 -2
- package/dist/rate-limits-CUv2cxXV.mjs +0 -3
- package/dist/raw-fetch-CxFs4i0R.mjs +0 -2
- package/dist/realtime-kit-C-jix3I_.mjs +0 -6
- package/dist/registrar-B7V7i89n.mjs +0 -2
- package/dist/request-tracers-D2V7QUrC.mjs +0 -2
- package/dist/resolve-GtphSYWh.mjs +0 -2
- package/dist/resource-sharing-BgH0w9wm.mjs +0 -5
- package/dist/resource-tagging-BOknFugv.mjs +0 -4
- package/dist/rolldown-runtime-CR7SCCRW.mjs +0 -2
- package/dist/rules-DzJFHGW1.mjs +0 -4
- package/dist/rulesets-BzI1dUiq.mjs +0 -8
- package/dist/rum-CQ_rJ96u.mjs +0 -4
- package/dist/schema-validation-TmikfxS9.mjs +0 -4
- package/dist/scim-ByZ5kqXS.mjs +0 -3
- package/dist/secrets-store-D7HL4VXw.mjs +0 -8
- package/dist/security-center-OUrILUnx.mjs +0 -2
- package/dist/security-txt-Ca13oCJ8.mjs +0 -3
- package/dist/session-Dxi_LbAk.mjs +0 -2
- package/dist/smart-shield-foPT0J9L.mjs +0 -3
- package/dist/snippets-FDPiBMWc.mjs +0 -4
- package/dist/spectrum-DPoh_BPx.mjs +0 -3
- package/dist/speed-BuEappVX.mjs +0 -4
- package/dist/src-D8_cWUwt.mjs +0 -104
- package/dist/ssl-bJbzEoRv.mjs +0 -3
- package/dist/stream-DuYGiGk6.mjs +0 -13
- package/dist/tenants-BYqEutrr.mjs +0 -2
- package/dist/token-validation-DwmtbWUB.mjs +0 -4
- package/dist/turnstile-Dy91RVTn.mjs +0 -3
- package/dist/url-normalization-DoD9iHWH.mjs +0 -3
- package/dist/url-scanner-qwL64FIo.mjs +0 -2
- package/dist/user-Cduf3VRi.mjs +0 -7
- package/dist/vectorize-CMLobU9V.mjs +0 -4
- package/dist/waiting-rooms-B4-IAJeT.mjs +0 -5
- package/dist/web3-Bcx68Kq3.mjs +0 -4
- package/dist/workers-D5fOQsUA.mjs +0 -16
- package/dist/workers-builds-2kdzxjlN.mjs +0 -7
- package/dist/workflows-qFD80noW.mjs +0 -4
- package/dist/zaraz-C0iJimA4.mjs +0 -2
- package/dist/zero-trust-Btix6zOy.mjs +0 -73
- package/dist/zones-Nu3wMtds.mjs +0 -5
- /package/dist/{metadata-DhSO1vle.mjs → metadata-DGdCpUxn.mjs} +0 -0
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{d as e,h as t,m as n,o as r,p as i,t as a}from"./auth-BHD_B2p9.mjs";import{n as o,r as s}from"./input-validation-BpVQi9rR.mjs";import{n as c,t as l}from"./body-parser-iA3vRFmh.mjs";import{t as u}from"./output-CqGQp2r6.mjs";import{t as d}from"./dry-run-FV0pZwdg.mjs";import{t as f}from"./local-OqhVQbv0.mjs";import{t as p}from"./progress-5sHFvwez.mjs";import{n as m,t as h}from"./raw-fetch-CxFs4i0R.mjs";const g={command:`create`,describe:`Create a new Catalog Sync (Closed Beta).`,builder:e=>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)`}),handler:async i=>{let m={};if(i.forwarded!==void 0&&(m.forwarded=String(i.forwarded)),i.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf magic-cloud-networking catalog-syncs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/magic/cloud/catalog-syncs`,pathParams:{},bodyKind:`json`,body:{description:i.description,destinationType:i.destinationType,name:i.name,policy:i.policy,updateMode:i.updateMode,body:i.body},validation:`passed`});return}let h=await a(i),g=i.local?f:await r(h);if(i.accountId=g,i.body){let e=l(i.body);u(await p(`Creating catalog sync`,async()=>h.post(`/accounts/${g}/magic/cloud/catalog-syncs`,{body:e,headers:Object.keys(m).length>0?m:void 0})),{successLabel:`Created catalog sync`});return}i.destinationType===void 0&&(i.destinationType=await n(`destination-type`,``,[`NONE`,`ZERO_TRUST_LIST`])),i.name===void 0&&(i.name=await t(`name`,``)),i.updateMode===void 0&&(i.updateMode=await n(`update-mode`,``,[`AUTO`,`MANUAL`]));let _={};i.description!==void 0&&c(_,[`description`],o(i.description,`description`,`text`)),i.destinationType!==void 0&&c(_,[`destination_type`],o(i.destinationType,`destinationType`,`text`)),i.name!==void 0&&c(_,[`name`],o(i.name,`name`,`text`)),i.policy!==void 0&&c(_,[`policy`],o(i.policy,`policy`,`text`)),i.updateMode!==void 0&&c(_,[`update_mode`],o(i.updateMode,`updateMode`,`text`)),u(await p(`Creating catalog sync`,async()=>h.post(`/accounts/${g}/magic/cloud/catalog-syncs`,{body:Object.keys(_).length>0?_:void 0,headers:Object.keys(m).length>0?m:void 0})),{successLabel:`Created catalog sync`})}},_={command:`delete <syncId>`,describe:`Delete a Catalog Sync (Closed Beta).`,builder:e=>e.positional(`syncId`,{type:`string`,description:`Sync ID`,demandOption:!0}).option(`delete-destination`,{type:`boolean`,description:`Delete destination`,default:!1}).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}),handler:async t=>{s(t.syncId,`syncId`);let n={};if(t.deleteDestination!==void 0&&(n.delete_destination=t.deleteDestination),t.dryRun){let r=e();r&&s(r,`accountId`),d({command:`cf magic-cloud-networking catalog-syncs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${r??`<account-id>`}/magic/cloud/catalog-syncs/${t.syncId??`<syncId>`}`,pathParams:{syncId:String(t.syncId??``)},bodyKind:`json`,body:{...n},validation:`passed`});return}let o=await a(t),c=t.local?f:await r(o);if(t.accountId=c,!await i(`catalog sync`,String(t.syncId??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}u(await p(`Deleting catalog sync`,async()=>o.magicCloudNetworking.catalogSyncs.delete(c,t.syncId,Object.keys(n).length>0?n:void 0)),{successLabel:`Deleted catalog sync`})}},v={command:`edit <syncId>`,describe:`Update a Catalog Sync (Closed Beta).`,builder:e=>e.positional(`syncId`,{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)`}),handler:async t=>{if(s(t.syncId,`syncId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf magic-cloud-networking catalog-syncs edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/magic/cloud/catalog-syncs/${t.syncId??`<syncId>`}`,pathParams:{syncId:String(t.syncId??``)},bodyKind:`json`,body:{description:t.description,name:t.name,policy:t.policy,updateMode:t.updateMode,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating catalog sync`,async()=>n.patch(`/accounts/${i}/magic/cloud/catalog-syncs/${t.syncId}`,{body:e})),{successLabel:`Updated catalog sync`});return}let m={};t.description!==void 0&&c(m,[`description`],o(t.description,`description`,`text`)),t.name!==void 0&&c(m,[`name`],o(t.name,`name`,`text`)),t.policy!==void 0&&c(m,[`policy`],o(t.policy,`policy`,`text`)),t.updateMode!==void 0&&c(m,[`update_mode`],o(t.updateMode,`updateMode`,`text`)),u(await p(`Updating catalog sync`,async()=>n.patch(`/accounts/${i}/magic/cloud/catalog-syncs/${t.syncId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated catalog sync`})}},y={command:`get <syncId>`,describe:`Read a Catalog Sync (Closed Beta).`,builder:e=>e.positional(`syncId`,{type:`string`,description:`Sync ID`,demandOption:!0}),handler:async e=>{s(e.syncId,`syncId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading catalog sync`,async()=>t.magicCloudNetworking.catalogSyncs.get(n,e.syncId)),{successLabel:`Loaded catalog sync`})}},b={command:`list`,describe:`List Catalog Syncs (Closed Beta).`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading catalog syncs`,async()=>t.magicCloudNetworking.catalogSyncs.list(n)),{successLabel:`Loaded catalog syncs`})}},x={command:`list`,describe:`List prebuilt catalog sync policies (Closed Beta).`,builder:e=>e.option(`destination-type`,{type:`string`,description:`Specify type of destination, omit to return all.`,choices:[`NONE`,`ZERO_TRUST_LIST`]}),handler:async e=>{let t={};e.destinationType!==void 0&&(t.destination_type=e.destinationType);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading prebuilt policies`,async()=>n.magicCloudNetworking.catalogSyncs.prebuiltPolicies.list(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded prebuilt policies`})}},S={command:`prebuilt-policies`,describe:`Synchronize cloud resource inventories from AWS, Azure, and GCP into a unified catalog`,builder:e=>e.command(x).demandCommand(1),handler:()=>{}},C={command:`refresh <syncId>`,describe:`Refresh a Catalog Sync's destination by running the sync policy against latest resource catalog (Closed Beta).`,builder:e=>e.positional(`syncId`,{type:`string`,description:`Sync ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{if(s(t.syncId,`syncId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf magic-cloud-networking catalog-syncs refresh`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/magic/cloud/catalog-syncs/${t.syncId??`<syncId>`}/refresh`,pathParams:{syncId:String(t.syncId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);t.accountId=i,u(await p(`Creating catalog sync`,async()=>n.magicCloudNetworking.catalogSyncs.refresh(i,t.syncId)),{successLabel:`Created catalog sync`})}},w={command:`update <syncId>`,describe:`Update a Catalog Sync (Closed Beta).`,builder:e=>e.positional(`syncId`,{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)`}),handler:async t=>{if(s(t.syncId,`syncId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf magic-cloud-networking catalog-syncs update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/magic/cloud/catalog-syncs/${t.syncId??`<syncId>`}`,pathParams:{syncId:String(t.syncId??``)},bodyKind:`json`,body:{description:t.description,name:t.name,policy:t.policy,updateMode:t.updateMode,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating catalog sync`,async()=>n.put(`/accounts/${i}/magic/cloud/catalog-syncs/${t.syncId}`,{body:e})),{successLabel:`Updated catalog sync`});return}let m={};t.description!==void 0&&c(m,[`description`],o(t.description,`description`,`text`)),t.name!==void 0&&c(m,[`name`],o(t.name,`name`,`text`)),t.policy!==void 0&&c(m,[`policy`],o(t.policy,`policy`,`text`)),t.updateMode!==void 0&&c(m,[`update_mode`],o(t.updateMode,`updateMode`,`text`)),u(await p(`Updating catalog sync`,async()=>n.put(`/accounts/${i}/magic/cloud/catalog-syncs/${t.syncId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated catalog sync`})}},T={command:`catalog-syncs`,describe:`Synchronize cloud resource inventories from AWS, Azure, and GCP into a unified catalog`,builder:e=>e.command(g).command(_).command(v).command(y).command(b).command(C).command(w).command(S).demandCommand(1),handler:()=>{}},E={command:`create`,describe:`Create a new Cloud Integration (Closed Beta).`,builder:e=>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)`}),handler:async i=>{let m={};if(i.forwarded!==void 0&&(m.forwarded=String(i.forwarded)),i.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf magic-cloud-networking cloud-integrations create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/magic/cloud/providers`,pathParams:{},bodyKind:`json`,body:{cloudType:i.cloudType,description:i.description,friendlyName:i.friendlyName,body:i.body},validation:`passed`});return}let h=await a(i),g=i.local?f:await r(h);if(i.accountId=g,i.body){let e=l(i.body);u(await p(`Creating cloud integration`,async()=>h.post(`/accounts/${g}/magic/cloud/providers`,{body:e,headers:Object.keys(m).length>0?m:void 0})),{successLabel:`Created cloud integration`});return}i.cloudType===void 0&&(i.cloudType=await n(`cloud-type`,``,[`AWS`,`AZURE`,`GOOGLE`,`CLOUDFLARE`])),i.friendlyName===void 0&&(i.friendlyName=await t(`friendly-name`,``));let _={};i.cloudType!==void 0&&c(_,[`cloud_type`],o(i.cloudType,`cloudType`,`text`)),i.description!==void 0&&c(_,[`description`],o(i.description,`description`,`text`)),i.friendlyName!==void 0&&c(_,[`friendly_name`],o(i.friendlyName,`friendlyName`,`text`)),u(await p(`Creating cloud integration`,async()=>h.post(`/accounts/${g}/magic/cloud/providers`,{body:Object.keys(_).length>0?_:void 0,headers:Object.keys(m).length>0?m:void 0})),{successLabel:`Created cloud integration`})}},D={command:`delete <providerId>`,describe:`Delete a Cloud Integration (Closed Beta).`,builder:e=>e.positional(`providerId`,{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}),handler:async t=>{if(s(t.providerId,`providerId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf magic-cloud-networking cloud-integrations delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/magic/cloud/providers/${t.providerId??`<providerId>`}`,pathParams:{providerId:String(t.providerId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`cloud integration`,String(t.providerId??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}u(await p(`Deleting cloud integration`,async()=>n.magicCloudNetworking.cloudIntegrations.delete(o,t.providerId)),{successLabel:`Deleted cloud integration`})}},O={command:`discover-all`,describe:`Run discovery for all Cloud Integrations in an account (Closed Beta).`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{if(t.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf magic-cloud-networking cloud-integrations discover-all`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/magic/cloud/providers/discover`,pathParams:{},bodyKind:`none`,validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);t.accountId=i,u(await p(`Creating cloud integration`,async()=>n.magicCloudNetworking.cloudIntegrations.discoverAll(i)),{successLabel:`Created cloud integration`})}},k={command:`discover <providerId>`,describe:`Run discovery for a Cloud Integration (Closed Beta).`,builder:e=>e.positional(`providerId`,{type:`string`,description:`Provider ID`,demandOption:!0}).option(`v2`,{type:`boolean`,description:`V2`,default:!1}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{s(t.providerId,`providerId`);let n={};if(t.v2!==void 0&&(n.v2=t.v2),t.dryRun){let r=e();r&&s(r,`accountId`),d({command:`cf magic-cloud-networking cloud-integrations discover`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${r??`<account-id>`}/magic/cloud/providers/${t.providerId??`<providerId>`}/discover`,pathParams:{providerId:String(t.providerId??``)},bodyKind:`json`,body:{...n},validation:`passed`});return}let i=await a(t),o=t.local?f:await r(i);t.accountId=o,u(await p(`Creating cloud integration`,async()=>i.magicCloudNetworking.cloudIntegrations.discover(o,t.providerId,Object.keys(n).length>0?n:void 0)),{successLabel:`Created cloud integration`})}},A={command:`edit <providerId>`,describe:`Update a Cloud Integration (Closed Beta).`,builder:e=>e.positional(`providerId`,{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)`}),handler:async t=>{if(s(t.providerId,`providerId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf magic-cloud-networking cloud-integrations edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/magic/cloud/providers/${t.providerId??`<providerId>`}`,pathParams:{providerId:String(t.providerId??``)},bodyKind:`json`,body:{awsArn:t.awsArn,azureSubscriptionId:t.azureSubscriptionId,azureTenantId:t.azureTenantId,description:t.description,friendlyName:t.friendlyName,gcpProjectId:t.gcpProjectId,gcpServiceAccountEmail:t.gcpServiceAccountEmail,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating cloud integration`,async()=>n.patch(`/accounts/${i}/magic/cloud/providers/${t.providerId}`,{body:e})),{successLabel:`Updated cloud integration`});return}let m={};t.awsArn!==void 0&&c(m,[`aws_arn`],o(t.awsArn,`awsArn`,`text`)),t.azureSubscriptionId!==void 0&&c(m,[`azure_subscription_id`],o(t.azureSubscriptionId,`azureSubscriptionId`,`text`)),t.azureTenantId!==void 0&&c(m,[`azure_tenant_id`],o(t.azureTenantId,`azureTenantId`,`text`)),t.description!==void 0&&c(m,[`description`],o(t.description,`description`,`text`)),t.friendlyName!==void 0&&c(m,[`friendly_name`],o(t.friendlyName,`friendlyName`,`text`)),t.gcpProjectId!==void 0&&c(m,[`gcp_project_id`],o(t.gcpProjectId,`gcpProjectId`,`text`)),t.gcpServiceAccountEmail!==void 0&&c(m,[`gcp_service_account_email`],o(t.gcpServiceAccountEmail,`gcpServiceAccountEmail`,`text`)),u(await p(`Updating cloud integration`,async()=>n.patch(`/accounts/${i}/magic/cloud/providers/${t.providerId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated cloud integration`})}},j={command:`get <providerId>`,describe:`Read a Cloud Integration (Closed Beta).`,builder:e=>e.positional(`providerId`,{type:`string`,description:`Provider ID`,demandOption:!0}).option(`status`,{type:`boolean`,description:`Status`,default:!1}),handler:async e=>{s(e.providerId,`providerId`);let t={};e.status!==void 0&&(t.status=e.status);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading cloud integration`,async()=>n.magicCloudNetworking.cloudIntegrations.get(i,e.providerId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded cloud integration`})}},M={command:`initial-setup <providerId>`,describe:`Get initial configuration to complete Cloud Integration setup (Closed Beta).`,builder:e=>e.positional(`providerId`,{type:`string`,description:`Provider ID`,demandOption:!0}),handler:async e=>{s(e.providerId,`providerId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading cloud integration`,async()=>t.magicCloudNetworking.cloudIntegrations.initialSetup(n,e.providerId)),{successLabel:`Loaded cloud integration`})}},N={command:`list`,describe:`List Cloud Integrations (Closed Beta).`,builder:e=>e.option(`status`,{type:`boolean`,description:`Status`,default:!1}).option(`order-by`,{type:`string`,description:`One of ["updated_at", "id", "cloud_type", "name"].`}).option(`desc`,{type:`boolean`,description:`Desc`,default:!1}).option(`cloudflare`,{type:`boolean`,description:`Cloudflare`,default:!1}),handler:async e=>{let t={};e.status!==void 0&&(t.status=e.status),e.orderBy!==void 0&&(t.order_by=e.orderBy),e.desc!==void 0&&(t.desc=e.desc),e.cloudflare!==void 0&&(t.cloudflare=e.cloudflare);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading cloud integrations`,async()=>n.magicCloudNetworking.cloudIntegrations.list(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded cloud integrations`})}},P={command:`update <providerId>`,describe:`Update a Cloud Integration (Closed Beta).`,builder:e=>e.positional(`providerId`,{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)`}),handler:async t=>{if(s(t.providerId,`providerId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf magic-cloud-networking cloud-integrations update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/magic/cloud/providers/${t.providerId??`<providerId>`}`,pathParams:{providerId:String(t.providerId??``)},bodyKind:`json`,body:{awsArn:t.awsArn,azureSubscriptionId:t.azureSubscriptionId,azureTenantId:t.azureTenantId,description:t.description,friendlyName:t.friendlyName,gcpProjectId:t.gcpProjectId,gcpServiceAccountEmail:t.gcpServiceAccountEmail,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating cloud integration`,async()=>n.put(`/accounts/${i}/magic/cloud/providers/${t.providerId}`,{body:e})),{successLabel:`Updated cloud integration`});return}let m={};t.awsArn!==void 0&&c(m,[`aws_arn`],o(t.awsArn,`awsArn`,`text`)),t.azureSubscriptionId!==void 0&&c(m,[`azure_subscription_id`],o(t.azureSubscriptionId,`azureSubscriptionId`,`text`)),t.azureTenantId!==void 0&&c(m,[`azure_tenant_id`],o(t.azureTenantId,`azureTenantId`,`text`)),t.description!==void 0&&c(m,[`description`],o(t.description,`description`,`text`)),t.friendlyName!==void 0&&c(m,[`friendly_name`],o(t.friendlyName,`friendlyName`,`text`)),t.gcpProjectId!==void 0&&c(m,[`gcp_project_id`],o(t.gcpProjectId,`gcpProjectId`,`text`)),t.gcpServiceAccountEmail!==void 0&&c(m,[`gcp_service_account_email`],o(t.gcpServiceAccountEmail,`gcpServiceAccountEmail`,`text`)),u(await p(`Updating cloud integration`,async()=>n.put(`/accounts/${i}/magic/cloud/providers/${t.providerId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated cloud integration`})}},ee={command:`cloud-integrations`,describe:`Cloud provider credentials and integrations for resource discovery and on-ramp provisioning`,builder:e=>e.command(E).command(D).command(k).command(O).command(A).command(j).command(M).command(N).command(P).demandCommand(1),handler:()=>{}},F={command:`edit`,describe:`Update the Magic WAN Address Space (Closed Beta).`,builder:e=>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)`}),handler:async t=>{if(t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf magic-cloud-networking on-ramps address-spaces edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/magic/cloud/onramps/magic_wan_address_space`,pathParams:{},bodyKind:`json`,body:{prefixes:t.prefixes,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating address space`,async()=>n.patch(`/accounts/${i}/magic/cloud/onramps/magic_wan_address_space`,{body:e})),{successLabel:`Updated address space`});return}if(t.prefixes===void 0)throw Error(`--prefixes is required (or pass --body with this field set).`);let o={};t.prefixes!==void 0&&c(o,[`prefixes`],t.prefixes),u(await p(`Updating address space`,async()=>n.patch(`/accounts/${i}/magic/cloud/onramps/magic_wan_address_space`,{body:Object.keys(o).length>0?o:void 0})),{successLabel:`Updated address space`})}},I={command:`list`,describe:`Read the Magic WAN Address Space (Closed Beta).`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading address spaces`,async()=>t.magicCloudNetworking.onRamps.addressSpaces.list(n)),{successLabel:`Loaded address spaces`})}},L={command:`update`,describe:`Update the Magic WAN Address Space (Closed Beta).`,builder:e=>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)`}),handler:async t=>{if(t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf magic-cloud-networking on-ramps address-spaces update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/magic/cloud/onramps/magic_wan_address_space`,pathParams:{},bodyKind:`json`,body:{prefixes:t.prefixes,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating address space`,async()=>n.put(`/accounts/${i}/magic/cloud/onramps/magic_wan_address_space`,{body:e})),{successLabel:`Updated address space`});return}if(t.prefixes===void 0)throw Error(`--prefixes is required (or pass --body with this field set).`);let o={};t.prefixes!==void 0&&c(o,[`prefixes`],t.prefixes),u(await p(`Updating address space`,async()=>n.put(`/accounts/${i}/magic/cloud/onramps/magic_wan_address_space`,{body:Object.keys(o).length>0?o:void 0})),{successLabel:`Updated address space`})}},R={command:`address-spaces`,describe:`On-ramp connections that bridge cloud VPCs/VNets to your Cloudflare network`,builder:e=>e.command(F).command(I).command(L).demandCommand(1),handler:()=>{}},z={command:`apply <onrampId>`,describe:`Apply an On-ramp (Closed Beta).`,builder:e=>e.positional(`onrampId`,{type:`string`,description:`Onramp ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{if(s(t.onrampId,`onrampId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf magic-cloud-networking on-ramps apply`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/magic/cloud/onramps/${t.onrampId??`<onrampId>`}/apply`,pathParams:{onrampId:String(t.onrampId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);t.accountId=i,u(await p(`Creating on ramp`,async()=>n.magicCloudNetworking.onRamps.apply(i,t.onrampId)),{successLabel:`Created on ramp`})}},B={command:`create`,describe:`Create a new On-ramp (Closed Beta).`,builder:e=>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)`}),handler:async i=>{let m={};if(i.forwarded!==void 0&&(m.forwarded=String(i.forwarded)),i.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf magic-cloud-networking on-ramps create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/magic/cloud/onramps`,pathParams:{},bodyKind:`json`,body:{adoptedHubId:i.adoptedHubId,attachedHubs:i.attachedHubs,attachedVpcs:i.attachedVpcs,cloudAsn:i.cloudAsn,cloudType:i.cloudType,description:i.description,dynamicRouting:i.dynamicRouting,hubProviderId:i.hubProviderId,installRoutesInCloud:i.installRoutesInCloud,installRoutesInMagicWan:i.installRoutesInMagicWan,manageHubToHubAttachments:i.manageHubToHubAttachments,manageVpcToHubAttachments:i.manageVpcToHubAttachments,name:i.name,region:i.region,type:i.type,vpc:i.vpc,body:i.body},validation:`passed`});return}let h=await a(i),g=i.local?f:await r(h);if(i.accountId=g,i.body){let e=l(i.body);u(await p(`Creating on ramp`,async()=>h.post(`/accounts/${g}/magic/cloud/onramps`,{body:e,headers:Object.keys(m).length>0?m:void 0})),{successLabel:`Created on ramp`});return}if(i.cloudType===void 0&&(i.cloudType=await n(`cloud-type`,``,[`AWS`,`AZURE`,`GOOGLE`])),i.dynamicRouting===void 0)throw Error(`--dynamic-routing is required (or pass --body with this field set).`);if(i.installRoutesInCloud===void 0)throw Error(`--install-routes-in-cloud is required (or pass --body with this field set).`);if(i.installRoutesInMagicWan===void 0)throw Error(`--install-routes-in-magic-wan is required (or pass --body with this field set).`);i.name===void 0&&(i.name=await t(`name`,``)),i.type===void 0&&(i.type=await n(`type`,``,[`OnrampTypeSingle`,`OnrampTypeHub`]));let _={};i.adoptedHubId!==void 0&&c(_,[`adopted_hub_id`],o(i.adoptedHubId,`adoptedHubId`,`text`)),i.attachedHubs!==void 0&&c(_,[`attached_hubs`],i.attachedHubs),i.attachedVpcs!==void 0&&c(_,[`attached_vpcs`],i.attachedVpcs),i.cloudAsn!==void 0&&c(_,[`cloud_asn`],i.cloudAsn),i.cloudType!==void 0&&c(_,[`cloud_type`],o(i.cloudType,`cloudType`,`text`)),i.description!==void 0&&c(_,[`description`],o(i.description,`description`,`text`)),i.dynamicRouting!==void 0&&c(_,[`dynamic_routing`],i.dynamicRouting),i.hubProviderId!==void 0&&c(_,[`hub_provider_id`],o(i.hubProviderId,`hubProviderId`,`text`)),i.installRoutesInCloud!==void 0&&c(_,[`install_routes_in_cloud`],i.installRoutesInCloud),i.installRoutesInMagicWan!==void 0&&c(_,[`install_routes_in_magic_wan`],i.installRoutesInMagicWan),i.manageHubToHubAttachments!==void 0&&c(_,[`manage_hub_to_hub_attachments`],i.manageHubToHubAttachments),i.manageVpcToHubAttachments!==void 0&&c(_,[`manage_vpc_to_hub_attachments`],i.manageVpcToHubAttachments),i.name!==void 0&&c(_,[`name`],o(i.name,`name`,`text`)),i.region!==void 0&&c(_,[`region`],o(i.region,`region`,`text`)),i.type!==void 0&&c(_,[`type`],o(i.type,`type`,`text`)),i.vpc!==void 0&&c(_,[`vpc`],o(i.vpc,`vpc`,`text`)),u(await p(`Creating on ramp`,async()=>h.post(`/accounts/${g}/magic/cloud/onramps`,{body:Object.keys(_).length>0?_:void 0,headers:Object.keys(m).length>0?m:void 0})),{successLabel:`Created on ramp`})}},V={command:`delete <onrampId>`,describe:`Delete an On-ramp (Closed Beta).`,builder:e=>e.positional(`onrampId`,{type:`string`,description:`Onramp ID`,demandOption:!0}).option(`destroy`,{type:`boolean`,description:`Destroy`,default:!1}).option(`force`,{type:`boolean`,description:`Force`,default:!1}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{s(t.onrampId,`onrampId`);let n={};if(t.destroy!==void 0&&(n.destroy=t.destroy),t.force!==void 0&&(n.force=t.force),t.dryRun){let r=e();r&&s(r,`accountId`),d({command:`cf magic-cloud-networking on-ramps delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${r??`<account-id>`}/magic/cloud/onramps/${t.onrampId??`<onrampId>`}`,pathParams:{onrampId:String(t.onrampId??``)},bodyKind:`json`,body:{...n},validation:`passed`});return}let o=await a(t),c=t.local?f:await r(o);if(t.accountId=c,!await i(`on ramp`,String(t.onrampId??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
5
|
-
`);return}u(await p(`Deleting on ramp`,async()=>o.magicCloudNetworking.onRamps.delete(c,t.onrampId,Object.keys(n).length>0?n:void 0)),{successLabel:`Deleted on ramp`})}},H={command:`edit <onrampId>`,describe:`Update an On-ramp (Closed Beta).`,builder:e=>e.positional(`onrampId`,{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)`}),handler:async t=>{if(s(t.onrampId,`onrampId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf magic-cloud-networking on-ramps edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/magic/cloud/onramps/${t.onrampId??`<onrampId>`}`,pathParams:{onrampId:String(t.onrampId??``)},bodyKind:`json`,body:{attachedHubs:t.attachedHubs,attachedVpcs:t.attachedVpcs,description:t.description,installRoutesInCloud:t.installRoutesInCloud,installRoutesInMagicWan:t.installRoutesInMagicWan,manageHubToHubAttachments:t.manageHubToHubAttachments,manageVpcToHubAttachments:t.manageVpcToHubAttachments,name:t.name,vpc:t.vpc,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating on ramp`,async()=>n.patch(`/accounts/${i}/magic/cloud/onramps/${t.onrampId}`,{body:e})),{successLabel:`Updated on ramp`});return}let m={};t.attachedHubs!==void 0&&c(m,[`attached_hubs`],t.attachedHubs),t.attachedVpcs!==void 0&&c(m,[`attached_vpcs`],t.attachedVpcs),t.description!==void 0&&c(m,[`description`],o(t.description,`description`,`text`)),t.installRoutesInCloud!==void 0&&c(m,[`install_routes_in_cloud`],t.installRoutesInCloud),t.installRoutesInMagicWan!==void 0&&c(m,[`install_routes_in_magic_wan`],t.installRoutesInMagicWan),t.manageHubToHubAttachments!==void 0&&c(m,[`manage_hub_to_hub_attachments`],t.manageHubToHubAttachments),t.manageVpcToHubAttachments!==void 0&&c(m,[`manage_vpc_to_hub_attachments`],t.manageVpcToHubAttachments),t.name!==void 0&&c(m,[`name`],o(t.name,`name`,`text`)),t.vpc!==void 0&&c(m,[`vpc`],o(t.vpc,`vpc`,`text`)),u(await p(`Updating on ramp`,async()=>n.patch(`/accounts/${i}/magic/cloud/onramps/${t.onrampId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated on ramp`})}},U={command:`export <onrampId>`,describe:`Export an On-ramp to terraform ready file(s) (Closed Beta).`,builder:e=>e.positional(`onrampId`,{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}),handler:async t=>{if(s(t.onrampId,`onrampId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf magic-cloud-networking on-ramps export`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/magic/cloud/onramps/${t.onrampId??`<onrampId>`}/export`,pathParams:{onrampId:String(t.onrampId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);t.accountId=i;let o=await p(`Loading on ramp`,async()=>h(`/accounts/${i}/magic/cloud/onramps/${t.onrampId}/export`,`POST`,t.local?t.localEndpoint:void 0));m(t.text===!0?o.toString(`utf-8`):o)}},W={command:`get <onrampId>`,describe:`Read an On-ramp (Closed Beta).`,builder:e=>e.positional(`onrampId`,{type:`string`,description:`Onramp ID`,demandOption:!0}).option(`status`,{type:`boolean`,description:`Status`,default:!1}).option(`vpcs`,{type:`boolean`,description:`Vpcs`,default:!1}).option(`post-apply-resources`,{type:`boolean`,description:`Post apply resources`,default:!1}).option(`planned-resources`,{type:`boolean`,description:`Planned resources`,default:!1}),handler:async e=>{s(e.onrampId,`onrampId`);let t={};e.status!==void 0&&(t.status=e.status),e.vpcs!==void 0&&(t.vpcs=e.vpcs),e.postApplyResources!==void 0&&(t.post_apply_resources=e.postApplyResources),e.plannedResources!==void 0&&(t.planned_resources=e.plannedResources);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading on ramp`,async()=>n.magicCloudNetworking.onRamps.get(i,e.onrampId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded on ramp`})}},G={command:`list`,describe:`List On-ramps (Closed Beta).`,builder:e=>e.option(`order-by`,{type:`string`,description:`One of ["updated_at", "id", "cloud_type", "name"].`}).option(`desc`,{type:`boolean`,description:`Desc`,default:!1}).option(`status`,{type:`boolean`,description:`Status`,default:!1}).option(`vpcs`,{type:`boolean`,description:`Vpcs`,default:!1}),handler:async e=>{let t={};e.orderBy!==void 0&&(t.order_by=e.orderBy),e.desc!==void 0&&(t.desc=e.desc),e.status!==void 0&&(t.status=e.status),e.vpcs!==void 0&&(t.vpcs=e.vpcs);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading on ramps`,async()=>n.magicCloudNetworking.onRamps.list(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded on ramps`})}},K={command:`plan <onrampId>`,describe:`Plan an On-ramp (Closed Beta).`,builder:e=>e.positional(`onrampId`,{type:`string`,description:`Onramp ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{if(s(t.onrampId,`onrampId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf magic-cloud-networking on-ramps plan`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/magic/cloud/onramps/${t.onrampId??`<onrampId>`}/plan`,pathParams:{onrampId:String(t.onrampId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);t.accountId=i,u(await p(`Creating on ramp`,async()=>n.magicCloudNetworking.onRamps.plan(i,t.onrampId)),{successLabel:`Created on ramp`})}},q={command:`update <onrampId>`,describe:`Update an On-ramp (Closed Beta).`,builder:e=>e.positional(`onrampId`,{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)`}),handler:async t=>{if(s(t.onrampId,`onrampId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf magic-cloud-networking on-ramps update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/magic/cloud/onramps/${t.onrampId??`<onrampId>`}`,pathParams:{onrampId:String(t.onrampId??``)},bodyKind:`json`,body:{attachedHubs:t.attachedHubs,attachedVpcs:t.attachedVpcs,description:t.description,installRoutesInCloud:t.installRoutesInCloud,installRoutesInMagicWan:t.installRoutesInMagicWan,manageHubToHubAttachments:t.manageHubToHubAttachments,manageVpcToHubAttachments:t.manageVpcToHubAttachments,name:t.name,vpc:t.vpc,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating on ramp`,async()=>n.put(`/accounts/${i}/magic/cloud/onramps/${t.onrampId}`,{body:e})),{successLabel:`Updated on ramp`});return}let m={};t.attachedHubs!==void 0&&c(m,[`attached_hubs`],t.attachedHubs),t.attachedVpcs!==void 0&&c(m,[`attached_vpcs`],t.attachedVpcs),t.description!==void 0&&c(m,[`description`],o(t.description,`description`,`text`)),t.installRoutesInCloud!==void 0&&c(m,[`install_routes_in_cloud`],t.installRoutesInCloud),t.installRoutesInMagicWan!==void 0&&c(m,[`install_routes_in_magic_wan`],t.installRoutesInMagicWan),t.manageHubToHubAttachments!==void 0&&c(m,[`manage_hub_to_hub_attachments`],t.manageHubToHubAttachments),t.manageVpcToHubAttachments!==void 0&&c(m,[`manage_vpc_to_hub_attachments`],t.manageVpcToHubAttachments),t.name!==void 0&&c(m,[`name`],o(t.name,`name`,`text`)),t.vpc!==void 0&&c(m,[`vpc`],o(t.vpc,`vpc`,`text`)),u(await p(`Updating on ramp`,async()=>n.put(`/accounts/${i}/magic/cloud/onramps/${t.onrampId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated on ramp`})}},J={command:`on-ramps`,describe:`On-ramp connections that bridge cloud VPCs/VNets to your Cloudflare network`,builder:e=>e.command(z).command(B).command(V).command(H).command(U).command(W).command(G).command(K).command(q).command(R).demandCommand(1),handler:()=>{}},Y={command:`export`,describe:`Export resources in the Resource Catalog as a JSON file (Closed Beta).`,builder:e=>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`,default:!1}).option(`v2`,{type:`boolean`,description:`V2`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1}),handler:async e=>{let t={};e.providerId!==void 0&&(t.provider_id=e.providerId),e.resourceType!==void 0&&(t.resource_type=e.resourceType),e.resourceId!==void 0&&(t.resource_id=e.resourceId),e.region!==void 0&&(t.region=e.region),e.resourceGroup!==void 0&&(t.resource_group=e.resourceGroup),e.search!==void 0&&(t.search=e.search),e.orderBy!==void 0&&(t.order_by=e.orderBy),e.desc!==void 0&&(t.desc=e.desc),e.v2!==void 0&&(t.v2=e.v2);let n=await a(e),i=e.local?f:await r(n);e.accountId=i;let o=await p(`Loading resource`,async()=>h(`/accounts/${i}/magic/cloud/resources/export`,`GET`,e.local?e.localEndpoint:void 0));m(e.text===!0?o.toString(`utf-8`):o)}},X={command:`get <resourceId>`,describe:`Read an resource from the Resource Catalog (Closed Beta).`,builder:e=>e.positional(`resourceId`,{type:`string`,description:`Resource ID`,demandOption:!0}).option(`v2`,{type:`boolean`,description:`V2`,default:!1}),handler:async e=>{s(e.resourceId,`resourceId`);let t={};e.v2!==void 0&&(t.v2=e.v2);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading resource`,async()=>n.magicCloudNetworking.resources.get(i,e.resourceId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded resource`})}},Z={command:`list`,describe:`List resources in the Resource Catalog (Closed Beta).`,builder:e=>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`,default:!1}).option(`search`,{type:`string`,description:`Search`}).option(`order-by`,{type:`string`,description:`One of ["id", "resource_type", "region"].`}).option(`desc`,{type:`boolean`,description:`Desc`,default:!1}).option(`per-page`,{type:`number`,description:`Per page`}).option(`page`,{type:`number`,description:`Page`}).option(`cloudflare`,{type:`boolean`,description:`Cloudflare`,default:!1}).option(`v2`,{type:`boolean`,description:`V2`,default:!1}),handler:async e=>{let t={};e.providerId!==void 0&&(t.provider_id=e.providerId),e.resourceType!==void 0&&(t.resource_type=e.resourceType),e.resourceId!==void 0&&(t.resource_id=e.resourceId),e.region!==void 0&&(t.region=e.region),e.resourceGroup!==void 0&&(t.resource_group=e.resourceGroup),e.managed!==void 0&&(t.managed=e.managed),e.search!==void 0&&(t.search=e.search),e.orderBy!==void 0&&(t.order_by=e.orderBy),e.desc!==void 0&&(t.desc=e.desc),e.perPage!==void 0&&(t.per_page=e.perPage),e.page!==void 0&&(t.page=e.page),e.cloudflare!==void 0&&(t.cloudflare=e.cloudflare),e.v2!==void 0&&(t.v2=e.v2);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading resources`,async()=>n.magicCloudNetworking.resources.list(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded resources`})}},Q={command:`policy-preview`,describe:`Preview Rego query result against the latest resource catalog (Closed Beta).`,builder:e=>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)`}),handler:async n=>{if(n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf magic-cloud-networking resources policy-preview`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/magic/cloud/resources/policy-preview`,pathParams:{},bodyKind:`json`,body:{policy:n.policy,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Creating resource`,async()=>i.post(`/accounts/${m}/magic/cloud/resources/policy-preview`,{body:e})),{successLabel:`Created resource`});return}n.policy===void 0&&(n.policy=await t(`policy`,``));let h={};n.policy!==void 0&&c(h,[`policy`],o(n.policy,`policy`,`text`)),u(await p(`Creating resource`,async()=>i.post(`/accounts/${m}/magic/cloud/resources/policy-preview`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created resource`})}},$={command:`resources`,describe:`Discovered cloud resources (VPCs, subnets, route tables) from connected cloud accounts`,builder:e=>e.command(Y).command(X).command(Z).command(Q).demandCommand(1),handler:()=>{}},te={command:`magic-cloud-networking`,describe:`Multi-cloud networking — discover cloud resources, manage on-ramps, and automate cross-cloud connectivity`,builder:e=>e.command(T).command(ee).command(J).command($).demandCommand(1),handler:()=>{}};export{te as default};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{d as e,h as t,m as n,o as r,p as i,t as a}from"./auth-BHD_B2p9.mjs";import{n as o,r as s}from"./input-validation-BpVQi9rR.mjs";import{n as c,t as l}from"./body-parser-iA3vRFmh.mjs";import{t as u}from"./output-CqGQp2r6.mjs";import{t as d}from"./dry-run-FV0pZwdg.mjs";import{t as f}from"./local-OqhVQbv0.mjs";import{t as p}from"./progress-5sHFvwez.mjs";const m={command:`create`,describe:`Create a new network monitoring configuration.`,builder:e=>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)`}),handler:async n=>{if(n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf magic-network-monitoring configs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/mnm/config`,pathParams:{},bodyKind:`json`,body:{defaultSampling:n.defaultSampling,name:n.name,routerIps:n.routerIps,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Creating config`,async()=>i.post(`/accounts/${m}/mnm/config`,{body:e})),{successLabel:`Created config`});return}if(n.defaultSampling===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 h={};n.defaultSampling!==void 0&&c(h,[`default_sampling`],n.defaultSampling),n.name!==void 0&&c(h,[`name`],o(n.name,`name`,`text`)),n.routerIps!==void 0&&c(h,[`router_ips`],n.routerIps),u(await p(`Creating config`,async()=>i.post(`/accounts/${m}/mnm/config`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created config`})}},h={command:`delete`,describe:`Delete an existing network monitoring configuration.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf magic-network-monitoring configs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/mnm/config`,pathParams:{},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`config`,``,{force:!!t.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}if(t.body){let e=l(t.body);u(await p(`Deleting config`,async()=>n.delete(`/accounts/${o}/mnm/config`,{body:e})),{successLabel:`Deleted config`});return}u(await p(`Deleting config`,async()=>n.magicNetworkMonitoring.configs.delete(o)),{successLabel:`Deleted config`})}},g={command:`edit`,describe:`Update fields in an existing network monitoring configuration.`,builder:e=>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)`}),handler:async t=>{if(t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf magic-network-monitoring configs edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/mnm/config`,pathParams:{},bodyKind:`json`,body:{defaultSampling:t.defaultSampling,name:t.name,routerIps:t.routerIps,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating config`,async()=>n.patch(`/accounts/${i}/mnm/config`,{body:e})),{successLabel:`Updated config`});return}let m={};t.defaultSampling!==void 0&&c(m,[`default_sampling`],t.defaultSampling),t.name!==void 0&&c(m,[`name`],o(t.name,`name`,`text`)),t.routerIps!==void 0&&c(m,[`router_ips`],t.routerIps),u(await p(`Updating config`,async()=>n.patch(`/accounts/${i}/mnm/config`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated config`})}},_={command:`get`,describe:`Lists default sampling, router IPs, warp devices, and rules for account.`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading full`,async()=>t.magicNetworkMonitoring.configs.full.get(n)),{successLabel:`Loaded full`})}},v={command:`full`,describe:`Account-level monitoring configuration — sampling rates, thresholds, and notification settings`,builder:e=>e.command(_).demandCommand(1),handler:()=>{}},y={command:`get`,describe:`Lists default sampling, router IPs and warp devices for account.`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading config`,async()=>t.magicNetworkMonitoring.configs.get(n)),{successLabel:`Loaded config`})}},b={command:`update`,describe:`Update an existing network monitoring configuration, requires the entire configuration to be updated at once.`,builder:e=>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)`}),handler:async n=>{if(n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf magic-network-monitoring configs update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/mnm/config`,pathParams:{},bodyKind:`json`,body:{defaultSampling:n.defaultSampling,name:n.name,routerIps:n.routerIps,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Updating config`,async()=>i.put(`/accounts/${m}/mnm/config`,{body:e})),{successLabel:`Updated config`});return}if(n.defaultSampling===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 h={};n.defaultSampling!==void 0&&c(h,[`default_sampling`],n.defaultSampling),n.name!==void 0&&c(h,[`name`],o(n.name,`name`,`text`)),n.routerIps!==void 0&&c(h,[`router_ips`],n.routerIps),u(await p(`Updating config`,async()=>i.put(`/accounts/${m}/mnm/config`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Updated config`})}},x={command:`configs`,describe:`Account-level monitoring configuration — sampling rates, thresholds, and notification settings`,builder:e=>e.command(m).command(h).command(g).command(y).command(b).command(v).demandCommand(1),handler:()=>{}},S={command:`edit <ruleId>`,describe:`Update advertisement for rule.`,builder:e=>e.positional(`ruleId`,{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(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(s(t.ruleId,`ruleId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf magic-network-monitoring rules advertisements edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/mnm/rules/${t.ruleId??`<ruleId>`}/advertisement`,pathParams:{ruleId:String(t.ruleId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating advertisement`,async()=>n.patch(`/accounts/${i}/mnm/rules/${t.ruleId}/advertisement`,{body:e})),{successLabel:`Updated advertisement`});return}u(await p(`Updating advertisement`,async()=>n.magicNetworkMonitoring.rules.advertisements.edit(t.ruleId,i)),{successLabel:`Updated advertisement`})}},C={command:`advertisements`,describe:`Monitoring rules that define traffic thresholds and trigger alerts or prefix advertisements`,builder:e=>e.command(S).demandCommand(1),handler:()=>{}},w={command:`create`,describe:`Create network monitoring rules for account. Currently only supports creating a single rule per API request.`,builder:e=>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)`}),handler:async i=>{if(i.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf magic-network-monitoring rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/mnm/rules`,pathParams:{},bodyKind:`json`,body:{automaticAdvertisement:i.automaticAdvertisement,bandwidthThreshold:i.bandwidthThreshold,duration:i.duration,name:i.name,packetThreshold:i.packetThreshold,prefixMatch:i.prefixMatch,prefixes:i.prefixes,type:i.type,zscoreSensitivity:i.zscoreSensitivity,zscoreTarget:i.zscoreTarget,body:i.body},validation:`passed`});return}let m=await a(i),h=i.local?f:await r(m);if(i.accountId=h,i.body){let e=l(i.body);u(await p(`Creating rule`,async()=>m.post(`/accounts/${h}/mnm/rules`,{body:e})),{successLabel:`Created rule`});return}if(i.automaticAdvertisement===void 0)throw Error(`--automatic-advertisement is required (or pass --body with this field set).`);if(i.name===void 0&&(i.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.`)),i.prefixes===void 0)throw Error(`--prefixes is required (or pass --body with this field set).`);i.type===void 0&&(i.type=await n(`type`,`MNM rule type.`,[`threshold`,`zscore`,`advanced_ddos`]));let g={};i.automaticAdvertisement!==void 0&&c(g,[`automatic_advertisement`],i.automaticAdvertisement),i.bandwidthThreshold!==void 0&&c(g,[`bandwidth_threshold`],i.bandwidthThreshold),i.duration!==void 0&&c(g,[`duration`],o(i.duration,`duration`,`text`)),i.name!==void 0&&c(g,[`name`],o(i.name,`name`,`text`)),i.packetThreshold!==void 0&&c(g,[`packet_threshold`],i.packetThreshold),i.prefixMatch!==void 0&&c(g,[`prefix_match`],o(i.prefixMatch,`prefixMatch`,`text`)),i.prefixes!==void 0&&c(g,[`prefixes`],i.prefixes),i.type!==void 0&&c(g,[`type`],o(i.type,`type`,`text`)),i.zscoreSensitivity!==void 0&&c(g,[`zscore_sensitivity`],o(i.zscoreSensitivity,`zscoreSensitivity`,`text`)),i.zscoreTarget!==void 0&&c(g,[`zscore_target`],o(i.zscoreTarget,`zscoreTarget`,`text`)),u(await p(`Creating rule`,async()=>m.post(`/accounts/${h}/mnm/rules`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Created rule`})}},T={command:`delete <ruleId>`,describe:`Delete a network monitoring rule for account.`,builder:e=>e.positional(`ruleId`,{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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(s(t.ruleId,`ruleId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf magic-network-monitoring rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/mnm/rules/${t.ruleId??`<ruleId>`}`,pathParams:{ruleId:String(t.ruleId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`rule`,String(t.ruleId??``),{force:!!t.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}if(t.body){let e=l(t.body);u(await p(`Deleting rule`,async()=>n.delete(`/accounts/${o}/mnm/rules/${t.ruleId}`,{body:e})),{successLabel:`Deleted rule`});return}u(await p(`Deleting rule`,async()=>n.magicNetworkMonitoring.rules.delete(t.ruleId,o)),{successLabel:`Deleted rule`})}},E={command:`edit <ruleId>`,describe:`Update a network monitoring rule for account.`,builder:e=>e.positional(`ruleId`,{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`],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)`}),handler:async i=>{if(s(i.ruleId,`ruleId`),i.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf magic-network-monitoring rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/mnm/rules/${i.ruleId??`<ruleId>`}`,pathParams:{ruleId:String(i.ruleId??``)},bodyKind:`json`,body:{automaticAdvertisement:i.automaticAdvertisement,bandwidthThreshold:i.bandwidthThreshold,duration:i.duration,name:i.name,packetThreshold:i.packetThreshold,prefixMatch:i.prefixMatch,prefixes:i.prefixes,type:i.type,zscoreSensitivity:i.zscoreSensitivity,zscoreTarget:i.zscoreTarget,body:i.body},validation:`passed`});return}let m=await a(i),h=i.local?f:await r(m);if(i.accountId=h,i.body){let e=l(i.body);u(await p(`Updating rule`,async()=>m.patch(`/accounts/${h}/mnm/rules/${i.ruleId}`,{body:e})),{successLabel:`Updated rule`});return}if(i.automaticAdvertisement===void 0)throw Error(`--automatic-advertisement is required (or pass --body with this field set).`);if(i.name===void 0&&(i.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.`)),i.prefixes===void 0)throw Error(`--prefixes is required (or pass --body with this field set).`);i.type===void 0&&(i.type=await n(`type`,`MNM rule type.`,[`threshold`,`zscore`,`advanced_ddos`]));let g={};i.automaticAdvertisement!==void 0&&c(g,[`automatic_advertisement`],i.automaticAdvertisement),i.bandwidthThreshold!==void 0&&c(g,[`bandwidth_threshold`],i.bandwidthThreshold),i.duration!==void 0&&c(g,[`duration`],o(i.duration,`duration`,`text`)),i.name!==void 0&&c(g,[`name`],o(i.name,`name`,`text`)),i.packetThreshold!==void 0&&c(g,[`packet_threshold`],i.packetThreshold),i.prefixMatch!==void 0&&c(g,[`prefix_match`],o(i.prefixMatch,`prefixMatch`,`text`)),i.prefixes!==void 0&&c(g,[`prefixes`],i.prefixes),i.type!==void 0&&c(g,[`type`],o(i.type,`type`,`text`)),i.zscoreSensitivity!==void 0&&c(g,[`zscore_sensitivity`],o(i.zscoreSensitivity,`zscoreSensitivity`,`text`)),i.zscoreTarget!==void 0&&c(g,[`zscore_target`],o(i.zscoreTarget,`zscoreTarget`,`text`)),u(await p(`Updating rule`,async()=>m.patch(`/accounts/${h}/mnm/rules/${i.ruleId}`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Updated rule`})}},D={command:`get <ruleId>`,describe:`List a single network monitoring rule for account.`,builder:e=>e.positional(`ruleId`,{type:`string`,description:`The id of the rule. Must be unique.`,demandOption:!0}),handler:async e=>{s(e.ruleId,`ruleId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading rule`,async()=>t.magicNetworkMonitoring.rules.get(e.ruleId,n)),{successLabel:`Loaded rule`})}},O={command:`list`,describe:`Lists network monitoring rules for account.`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading rules`,async()=>t.magicNetworkMonitoring.rules.list(n)),{successLabel:`Loaded rules`})}},k={command:`update`,describe:`Update network monitoring rules for account.`,builder:e=>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)`}),handler:async i=>{if(i.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf magic-network-monitoring rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/mnm/rules`,pathParams:{},bodyKind:`json`,body:{automaticAdvertisement:i.automaticAdvertisement,bandwidthThreshold:i.bandwidthThreshold,duration:i.duration,name:i.name,packetThreshold:i.packetThreshold,prefixMatch:i.prefixMatch,prefixes:i.prefixes,type:i.type,zscoreSensitivity:i.zscoreSensitivity,zscoreTarget:i.zscoreTarget,body:i.body},validation:`passed`});return}let m=await a(i),h=i.local?f:await r(m);if(i.accountId=h,i.body){let e=l(i.body);u(await p(`Updating rule`,async()=>m.put(`/accounts/${h}/mnm/rules`,{body:e})),{successLabel:`Updated rule`});return}if(i.automaticAdvertisement===void 0)throw Error(`--automatic-advertisement is required (or pass --body with this field set).`);if(i.name===void 0&&(i.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.`)),i.prefixes===void 0)throw Error(`--prefixes is required (or pass --body with this field set).`);i.type===void 0&&(i.type=await n(`type`,`MNM rule type.`,[`threshold`,`zscore`,`advanced_ddos`]));let g={};i.automaticAdvertisement!==void 0&&c(g,[`automatic_advertisement`],i.automaticAdvertisement),i.bandwidthThreshold!==void 0&&c(g,[`bandwidth_threshold`],i.bandwidthThreshold),i.duration!==void 0&&c(g,[`duration`],o(i.duration,`duration`,`text`)),i.name!==void 0&&c(g,[`name`],o(i.name,`name`,`text`)),i.packetThreshold!==void 0&&c(g,[`packet_threshold`],i.packetThreshold),i.prefixMatch!==void 0&&c(g,[`prefix_match`],o(i.prefixMatch,`prefixMatch`,`text`)),i.prefixes!==void 0&&c(g,[`prefixes`],i.prefixes),i.type!==void 0&&c(g,[`type`],o(i.type,`type`,`text`)),i.zscoreSensitivity!==void 0&&c(g,[`zscore_sensitivity`],o(i.zscoreSensitivity,`zscoreSensitivity`,`text`)),i.zscoreTarget!==void 0&&c(g,[`zscore_target`],o(i.zscoreTarget,`zscoreTarget`,`text`)),u(await p(`Updating rule`,async()=>m.put(`/accounts/${h}/mnm/rules`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Updated rule`})}},A={command:`rules`,describe:`Monitoring rules that define traffic thresholds and trigger alerts or prefix advertisements`,builder:e=>e.command(w).command(T).command(E).command(D).command(O).command(k).command(C).demandCommand(1),handler:()=>{}},j={command:`create`,describe:`Generate authentication token for VPC flow logs export.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{if(t.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf magic-network-monitoring vpc-flows tokens create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/mnm/vpc-flows/token`,pathParams:{},bodyKind:`none`,validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);t.accountId=i,u(await p(`Creating token`,async()=>n.magicNetworkMonitoring.vpcFlows.tokens.create(i)),{successLabel:`Created token`})}},M={command:`tokens`,describe:`Ingest VPC flow logs from cloud providers for network visibility and anomaly detection`,builder:e=>e.command(j).demandCommand(1),handler:()=>{}},N={command:`vpc-flows`,describe:`Operations for vpc-flows`,builder:e=>e.command(M).demandCommand(1),handler:()=>{}},P={command:`magic-network-monitoring`,describe:`Flow-based network traffic monitoring with configurable alerting rules and VPC flow ingestion`,builder:e=>e.command(x).command(A).command(N).demandCommand(1),handler:()=>{}};export{P as default};
|