cf 0.1.0 → 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/dist/_meta/agent-context.json +88 -88
- package/dist/_meta/commands.json +5268 -5350
- 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/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-DQ8miey6.mjs → auth-DenWm_X0.mjs} +3 -3
- package/dist/autorag-CmrwnGVj.mjs +2 -0
- package/dist/{billing-lwBHNTXC.mjs → billing-CaW1ZAB1.mjs} +1 -1
- 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/cache-DmXizSMi.mjs +5 -0
- package/dist/calls-x4KQpTB4.mjs +4 -0
- package/dist/certificate-authorities-hC0SG-Ga.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/{config-BIfdEY0E.mjs → config-DYzlVxcB.mjs} +1 -1
- 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 +1 -1
- package/dist/deploy-DbkiIzUr.mjs +2 -0
- package/dist/{dev-BfKYB-R_.mjs → dev-C6iSuQZm.mjs} +1 -1
- package/dist/diagnostics-DEEhPnXj.mjs +3 -0
- package/dist/dispatch-namespaces-BzXeV7PH.mjs +7 -0
- package/dist/{dist-C_bu5HwZ.mjs → dist-CnSubA1Z.mjs} +1 -1
- 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/intel-BM6xkZ0C.mjs +3 -0
- package/dist/{ips-B0cK7D0_.mjs → ips-B8fwxKZD.mjs} +1 -1
- 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/load-balancers-C1Ho1gCF.mjs +6 -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/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-DZfTxbrx.mjs → progress-CjcQ6ato.mjs} +1 -1
- 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-7Qy50zbW.mjs → registrar-DIIv6fWd.mjs} +6 -6
- package/dist/request-tracers-DMej0Drs.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-validation-MCd3xdtX.mjs +4 -0
- package/dist/scim-DZA3VXog.mjs +3 -0
- 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-mW-s8ghP.mjs → session-H7IV2BrM.mjs} +1 -1
- 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-D_cjG87Z.mjs → spawn-13QQ0IwO.mjs} +1 -1
- package/dist/spectrum-B0adfSRI.mjs +59 -0
- package/dist/speed-BVcUtkAz.mjs +4 -0
- package/dist/{src-C5qivNKH.mjs → src-B9cKsgsg.mjs} +8 -8
- package/dist/ssl-BAa91gsc.mjs +15 -0
- package/dist/stream-D53sxKb3.mjs +14 -0
- package/dist/tenants-bH5pt3dJ.mjs +2 -0
- package/dist/token-validation-M61Vx_Tw.mjs +4 -0
- package/dist/turnstile-wAU0Gc2Z.mjs +23 -0
- package/dist/{ui-mP_arYIg.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/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 +4 -4
- package/dist/abuse-reports-ChV_yD7f.mjs +0 -8
- package/dist/accounts-BCYecXFh.mjs +0 -21
- package/dist/acm-DD8zSds2.mjs +0 -3
- package/dist/addressing-D4Eqw5Bi.mjs +0 -13
- package/dist/ai-DfXMOMx_.mjs +0 -2
- package/dist/ai-gateway-DdRFthMo.mjs +0 -8
- package/dist/ai-search-C_68CDj1.mjs +0 -7
- package/dist/alerting-DbhqhVCp.mjs +0 -6
- package/dist/analytics-BSBBc7ep.mjs +0 -20
- package/dist/api-gateway-CZ4swbkQ.mjs +0 -33
- package/dist/argo-tms9ZwHO.mjs +0 -2
- package/dist/audit-logs-24qyW8cl.mjs +0 -2
- package/dist/auth-BlSmtIKd.mjs +0 -112
- package/dist/autorag-kgNt06GD.mjs +0 -2
- package/dist/bot-management-LKf7BqUr.mjs +0 -5
- package/dist/botnet-feed-nQ-gErTS.mjs +0 -3
- package/dist/brand-protection-DOKv9GRr.mjs +0 -3
- package/dist/browser-rendering-CBExtgGt.mjs +0 -4
- package/dist/build-C_48VvoK.mjs +0 -1056
- package/dist/cache-BBiiNZHP.mjs +0 -5
- package/dist/calls-DA5Xzwev.mjs +0 -4
- package/dist/certificate-authorities-sXyR_yGp.mjs +0 -2
- package/dist/client-certificates-tV0aCLQJ.mjs +0 -3
- package/dist/cloud-connector-DZfHcSso.mjs +0 -2
- package/dist/cloudforce-one-y1PgQmI9.mjs +0 -21
- package/dist/connectivity-8SOqaFDn.mjs +0 -3
- package/dist/content-scanning-B9y6K_G5.mjs +0 -4
- package/dist/context-DTIbtQn5.mjs +0 -2
- package/dist/custom-certificates-sWksR8Ys.mjs +0 -5
- package/dist/custom-hostnames-91QZkdqN.mjs +0 -5
- package/dist/custom-nameservers-DajZaZvE.mjs +0 -3
- package/dist/custom-pages-Cu7gmwzT.mjs +0 -4
- package/dist/d1-H_VRsVmF.mjs +0 -3
- package/dist/dcv-delegation-C-qhEYEZ.mjs +0 -2
- package/dist/deploy--9wYOkHg.mjs +0 -2
- package/dist/diagnostics-D2B2LPZZ.mjs +0 -3
- package/dist/dispatch-namespaces-CyrXBU_w.mjs +0 -7
- package/dist/dist-DvKjT2TT.mjs +0 -303
- package/dist/dns-Bn9Uz_Nj.mjs +0 -29
- package/dist/dns-firewall-BslP4p-j.mjs +0 -57
- package/dist/durable-objects-BN1ZnHhm.mjs +0 -2
- package/dist/email-routing-n2TnTaRR.mjs +0 -10
- package/dist/email-security-C9SEx0kh.mjs +0 -60
- package/dist/email-sending-DayZ7u3I.mjs +0 -3
- package/dist/filters-CI_XTgfQ.mjs +0 -4
- package/dist/firewall-CcaayGig.mjs +0 -11
- package/dist/fraud-Cr7aPCV8.mjs +0 -8
- package/dist/google-tag-gateway-B3GpYgQ4.mjs +0 -2
- package/dist/healthchecks-CVTsR_OC.mjs +0 -4
- package/dist/hostnames-Bd_Wa5l6.mjs +0 -3
- package/dist/hyperdrive-BBJhEDZd.mjs +0 -18
- package/dist/iam-D_FN0pDF.mjs +0 -6
- package/dist/images-CAP2hAlZ.mjs +0 -5
- package/dist/intel-CkxfzqmJ.mjs +0 -3
- package/dist/keyless-certificates-LcLmHZsX.mjs +0 -3
- package/dist/kv-_TkUQ6fs.mjs +0 -5
- package/dist/leaked-credential-checks-Dhvaen22.mjs +0 -3
- package/dist/load-balancers-Ckr0UIpk.mjs +0 -6
- package/dist/logpush-Cj946hxT.mjs +0 -4
- package/dist/logs-DgC9hjvJ.mjs +0 -3
- package/dist/magic-cloud-networking-WbDvPzuG.mjs +0 -5
- package/dist/magic-network-monitoring-BcHShvGQ.mjs +0 -4
- package/dist/magic-transit-B8sCOkt_.mjs +0 -89
- package/dist/managed-transforms-BpOr-8HY.mjs +0 -3
- package/dist/mtls-certificates-fOul8D5g.mjs +0 -3
- package/dist/network-interconnects-BSW65xlh.mjs +0 -36
- package/dist/organizations-T4vKGFAb.mjs +0 -41
- package/dist/origin-ca-certificates-ChM0lZ64.mjs +0 -3
- package/dist/origin-post-quantum-encryption-C7o26ARh.mjs +0 -2
- package/dist/origin-tls-client-auth-D32dpZk_.mjs +0 -5
- package/dist/page-rules-RFoj8CjN.mjs +0 -18
- package/dist/page-shield-VTktzKDN.mjs +0 -37
- package/dist/pages-L1ITjXDZ.mjs +0 -10
- package/dist/pipelines-BPO0Lnil.mjs +0 -6
- package/dist/queues-B0C06L9r.mjs +0 -6
- package/dist/r2-DP020Tmq.mjs +0 -21
- package/dist/r2-data-catalog-Dmipvz5F.mjs +0 -14
- package/dist/radar-DR3VMknH.mjs +0 -2
- package/dist/rate-limits-DnHPBPgU.mjs +0 -5
- package/dist/raw-fetch-DlXYwVA8.mjs +0 -2
- package/dist/realtime-kit-C430aq2d.mjs +0 -6
- package/dist/request-tracers-sv99NDIl.mjs +0 -2
- package/dist/resource-sharing-uEjC7lnQ.mjs +0 -5
- package/dist/resource-tagging-CiODdP3N.mjs +0 -16
- package/dist/rules-FXAyTrwk.mjs +0 -4
- package/dist/rulesets-B6aUsFFB.mjs +0 -8
- package/dist/rum-CyyGJhp5.mjs +0 -4
- package/dist/schema-validation-ByU49h--.mjs +0 -4
- package/dist/scim-DdTS65_C.mjs +0 -3
- package/dist/secrets-store-ClOUVhBJ.mjs +0 -18
- package/dist/security-center-4iSBqTrf.mjs +0 -2
- package/dist/security-txt-kGxdkDY6.mjs +0 -3
- package/dist/smart-shield-B-SQd2Qp.mjs +0 -3
- package/dist/snippets-Aq58ojqw.mjs +0 -4
- package/dist/spectrum-0gFvGI6y.mjs +0 -59
- package/dist/speed-DAZU8w3T.mjs +0 -4
- package/dist/ssl-BRlXa-5w.mjs +0 -15
- package/dist/stream-BAxsVeBX.mjs +0 -14
- package/dist/tenants-Df6xDqoA.mjs +0 -2
- package/dist/token-validation-pO4dCjCy.mjs +0 -4
- package/dist/turnstile-B1dmO8wE.mjs +0 -23
- package/dist/url-normalization-sUDVmrUt.mjs +0 -3
- package/dist/url-scanner-CwOKRkYo.mjs +0 -2
- package/dist/user-D_UrIdNq.mjs +0 -10
- package/dist/vectorize-BEbBn9G9.mjs +0 -4
- package/dist/waiting-rooms-BQC-urV4.mjs +0 -11
- package/dist/web3-CIH2iQeX.mjs +0 -4
- package/dist/workers-B9EvrpH3.mjs +0 -16
- package/dist/workers-builds-DzWSiRd2.mjs +0 -7
- package/dist/workflows-aD81gA4k.mjs +0 -4
- package/dist/zaraz-Cg1dsvrZ.mjs +0 -2
- package/dist/zero-trust-D-xQXWcy.mjs +0 -119
- package/dist/zones-DQzucJDd.mjs +0 -28
- /package/dist/{schema-D0_cbcDt.mjs → schema-CHBfkARI.mjs} +0 -0
- /package/dist/{tools-CtKbk6VS.mjs → tools-B7QiNu-d.mjs} +0 -0
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{a as e,f as t,m as n,t as r,u as i}from"./auth-BlSmtIKd.mjs";import{n as a,t as o}from"./body-parser-Br-BoYk-.mjs";import{t as s}from"./output-D7_yAFVR.mjs";import{n as c,t as l}from"./progress-DZfTxbrx.mjs";import{n as u}from"./input-validation-zEO81MWN.mjs";import{t as d}from"./local-VJaJ3BZ1.mjs";import{n as f,t as p}from"./raw-fetch-DlXYwVA8.mjs";function m(e){return e.option(`burst-sensitivity`,{type:`string`,description:`The burst sensitivity. Must be one of 'low', 'medium', 'high'.`}).option(`mode`,{type:`string`,description:`The mode for DNS Protection. Must be one of 'enabled', 'disabled', 'monitoring'.`}).option(`name`,{type:`string`,description:`The name of the DNS Protection rule. Value is relative to the 'scope' setting. For 'global' scope, name should be 'global'. For either the 'region' or 'datacenter' scope, name should be the actual name of the region or datacenter, e.g., 'wnam' or 'lax'.`}).option(`profile-sensitivity`,{type:`string`,description:`The profile sensitivity. Recommended setting is 'low'. Must be one of 'low', 'medium', 'high', or 'very_high'.`}).option(`rate-sensitivity`,{type:`string`,description:`The rate sensitivity. Must be one of 'low', 'medium', 'high'.`}).option(`scope`,{type:`string`,description:`The scope for the DNS Protection rule. Must be one of 'global', 'region', or 'datacenter'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The new DNS Protection rule to add.`})}const h={command:`create`,describe:`Create a DNS Protection rule for an account.`,builder:m,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit advanced-dns-protection configs dns protection rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_dns_protection/configs/dns_protection/rules`,pathParams:{},bodyKind:`json`,body:{burstSensitivity:t.burstSensitivity,mode:t.mode,name:t.name,profileSensitivity:t.profileSensitivity,rateSensitivity:t.rateSensitivity,scope:t.scope,body:t.body}});return}let f=await r(t),p=t.local?d:await e(f);if(t.accountId=p,t.body){let e=o(t.body);s(await l(`Creating`,async()=>f.post(`/accounts/${p}/magic/advanced_dns_protection/configs/dns_protection/rules`,{body:e})),{successLabel:`Created`});return}t.burstSensitivity===void 0&&(t.burstSensitivity=await n(`burst-sensitivity`,`The burst sensitivity. Must be one of 'low', 'medium', 'high'.`)),t.mode===void 0&&(t.mode=await n(`mode`,`The mode for DNS Protection. Must be one of 'enabled', 'disabled', 'monitoring'.`)),t.name===void 0&&(t.name=await n(`name`,`The name of the DNS Protection rule. Value is relative to the 'scope' setting. For 'global' scope, name should be 'global'. For either the 'region' or 'datacenter' scope, name should be the actual name of the region or datacenter, e.g., 'wnam' or 'lax'.`)),t.profileSensitivity===void 0&&(t.profileSensitivity=await n(`profile-sensitivity`,`The profile sensitivity. Recommended setting is 'low'. Must be one of 'low', 'medium', 'high', or 'very_high'.`)),t.rateSensitivity===void 0&&(t.rateSensitivity=await n(`rate-sensitivity`,`The rate sensitivity. Must be one of 'low', 'medium', 'high'.`)),t.scope===void 0&&(t.scope=await n(`scope`,`The scope for the DNS Protection rule. Must be one of 'global', 'region', or 'datacenter'.`));let m={};t.burstSensitivity!==void 0&&a(m,[`burst_sensitivity`],u(t.burstSensitivity,`burstSensitivity`,`text`)),t.mode!==void 0&&a(m,[`mode`],u(t.mode,`mode`,`text`)),t.name!==void 0&&a(m,[`name`],u(t.name,`name`,`text`)),t.profileSensitivity!==void 0&&a(m,[`profile_sensitivity`],u(t.profileSensitivity,`profileSensitivity`,`text`)),t.rateSensitivity!==void 0&&a(m,[`rate_sensitivity`],u(t.rateSensitivity,`rateSensitivity`,`text`)),t.scope!==void 0&&a(m,[`scope`],u(t.scope,`scope`,`text`)),s(await l(`Creating`,async()=>f.post(`/accounts/${p}/magic/advanced_dns_protection/configs/dns_protection/rules`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function ee(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 te={command:`account`,describe:`Delete all DNS Protection rules for an account.`,builder:ee,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-dns-protection configs dns protection rules delete for account`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_dns_protection/configs/dns_protection/rules`,pathParams:{},bodyKind:`none`});return}let a=await r(n),o=n.local?d:await e(a);if(n.accountId=o,!await t({force:!!n.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}s(await l(`Deleting`,async()=>a.magicTransit.advancedDNSProtection.configs.dns.protection.rules.delete.for.account(o)),{successLabel:`Deleted`})}},g={command:`for`,describe:`Advanced Dns Protection operations`,builder:e=>e.command(te).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function _(e){return e.positional(`ruleId`,{type:`string`,description:`The UUID of the DNS Protection rule to delete.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const v={command:`rule <ruleId>`,describe:`Delete a DNS Protection rule specified by the given UUID.`,builder:_,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-dns-protection configs dns protection rules delete protection rule`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_dns_protection/configs/dns_protection/rules/${n.ruleId??`<ruleId>`}`,pathParams:{ruleId:String(n.ruleId??``)},bodyKind:`none`});return}let a=await r(n),o=n.local?d:await e(a);if(n.accountId=o,!await t({force:!!n.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}s(await l(`Deleting`,async()=>a.magicTransit.advancedDNSProtection.configs.dns.protection.rules.delete.protection.rule(o,n.ruleId)),{successLabel:`Deleted`})}},y={command:`protection`,describe:`Advanced Dns Protection operations`,builder:e=>e.command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},b={command:`delete`,describe:`Operations for advanced-dns-protection.configs.dns.protection.rules.delete`,builder:e=>e.command(g).command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function x(e){return e.positional(`ruleId`,{type:`string`,description:`The UUID of the DNS Protection rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`get <ruleId>`,describe:`Get a DNS Protection rule specified by the given UUID.`,builder:x,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit advanced-dns-protection configs dns protection rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_dns_protection/configs/dns_protection/rules/${t.ruleId??`<ruleId>`}`,pathParams:{ruleId:String(t.ruleId??``)},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.magicTransit.advancedDNSProtection.configs.dns.protection.rules.get(a,t.ruleId)),{successLabel:`Loaded`})}};function C(e){return e.option(`page`,{type:`number`,description:`The page number for pagination. Defaults to 1.`}).option(`per-page`,{type:`number`,description:`The number of items per page. Must be between 10 and 1000. Defaults to 25.`}).option(`order`,{type:`string`,description:`The field to order by. Defaults to 'prefix'.`}).option(`direction`,{type:`string`,description:`The direction of ordering (ASC or DESC). Defaults to 'ASC'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`list`,describe:`List all DNS Protection rules for an account.`,builder:C,handler:async t=>{let n={page:t.page,per_page:t.perPage,order:t.order,direction:t.direction};if(t.dryRun){c({command:`cf magic-transit advanced-dns-protection configs dns protection rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_dns_protection/configs/dns_protection/rules`,pathParams:{},query:n,bodyKind:`none`});return}let a=await r(t),o=t.local?d:await e(a);t.accountId=o,s(await l(`Loading`,async()=>a.magicTransit.advancedDNSProtection.configs.dns.protection.rules.list(o,n)),{successLabel:`Loaded`})}};function T(e){return e.positional(`ruleId`,{type:`string`,description:`The UUID of the DNS Protection rule to update.`,demandOption:!0}).option(`burst-sensitivity`,{type:`string`,description:`The new burst sensitivity. Optional. Must be one of 'low', 'medium', 'high'.`}).option(`mode`,{type:`string`,description:`The new mode for DNS Protection. Optional. Must be one of 'enabled', 'disabled', 'monitoring'.`}).option(`profile-sensitivity`,{type:`string`,description:`The new profile sensitivity. Optional. Recommended setting is 'low'. Must be one of 'low', 'medium', 'high', or 'very_high'.`}).option(`rate-sensitivity`,{type:`string`,description:`The new rate sensitivity. Optional. Must be one of 'low', 'medium', 'high'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The updates to apply to the DNS Protection rule.`})}const E={command:`update <ruleId>`,describe:`Update a DNS Protection rule specified by the given UUID.`,builder:T,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit advanced-dns-protection configs dns protection rules update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_dns_protection/configs/dns_protection/rules/${t.ruleId??`<ruleId>`}`,pathParams:{ruleId:String(t.ruleId??``)},bodyKind:`json`,body:{burstSensitivity:t.burstSensitivity,mode:t.mode,profileSensitivity:t.profileSensitivity,rateSensitivity:t.rateSensitivity,body:t.body}});return}let n=await r(t),f=t.local?d:await e(n);if(t.accountId=f,t.body){let e=o(t.body);s(await l(`Updating`,async()=>n.patch(`/accounts/${f}/magic/advanced_dns_protection/configs/dns_protection/rules/${t.ruleId}`,{body:e})),{successLabel:`Updated`});return}let p={};t.burstSensitivity!==void 0&&a(p,[`burst_sensitivity`],u(t.burstSensitivity,`burstSensitivity`,`text`)),t.mode!==void 0&&a(p,[`mode`],u(t.mode,`mode`,`text`)),t.profileSensitivity!==void 0&&a(p,[`profile_sensitivity`],u(t.profileSensitivity,`profileSensitivity`,`text`)),t.rateSensitivity!==void 0&&a(p,[`rate_sensitivity`],u(t.rateSensitivity,`rateSensitivity`,`text`)),s(await l(`Updating`,async()=>n.patch(`/accounts/${f}/magic/advanced_dns_protection/configs/dns_protection/rules/${t.ruleId}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}},D={command:`rules`,describe:`Advanced Dns Protection operations`,builder:e=>e.command(h).command(S).command(w).command(E).command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},O={command:`protection`,describe:`Operations for advanced-dns-protection.configs.dns.protection`,builder:e=>e.command(D).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},k={command:`dns`,describe:`Operations for advanced-dns-protection.configs.dns`,builder:e=>e.command(O).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},A={command:`configs`,describe:`Operations for advanced-dns-protection.configs`,builder:e=>e.command(k).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},j={command:`advanced-dns-protection`,describe:`Operations for advanced-dns-protection`,builder:e=>e.command(A).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function M(e){return e.option(`comment`,{type:`string`,description:`An comment describing the allowlist prefix.`}).option(`enabled`,{type:`boolean`,description:`Whether to enable the allowlist prefix into effect.`}).option(`prefix`,{type:`string`,description:`The allowlist prefix to add in CIDR format.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The new allowlist prefix to create.`})}const N={command:`create`,describe:`Create an allowlist prefix for an account.`,builder:M,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs allowlist create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/allowlist`,pathParams:{},bodyKind:`json`,body:{comment:t.comment,enabled:t.enabled,prefix:t.prefix,body:t.body}});return}let f=await r(t),p=t.local?d:await e(f);if(t.accountId=p,t.body){let e=o(t.body);s(await l(`Creating`,async()=>f.post(`/accounts/${p}/magic/advanced_tcp_protection/configs/allowlist`,{body:e})),{successLabel:`Created`});return}if(t.comment===void 0&&(t.comment=await n(`comment`,`An comment describing the allowlist prefix.`)),t.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);t.prefix===void 0&&(t.prefix=await n(`prefix`,`The allowlist prefix to add in CIDR format.`));let m={};t.comment!==void 0&&a(m,[`comment`],u(t.comment,`comment`,`text`)),t.enabled!==void 0&&a(m,[`enabled`],t.enabled),t.prefix!==void 0&&a(m,[`prefix`],u(t.prefix,`prefix`,`text`)),s(await l(`Creating`,async()=>f.post(`/accounts/${p}/magic/advanced_tcp_protection/configs/allowlist`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function P(e){return e.positional(`prefixId`,{type:`string`,description:`The UUID of the allowlist prefix to delete.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const F={command:`prefix <prefixId>`,describe:`Delete the allowlist prefix for an account given a UUID.`,builder:P,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs allowlist delete allowlist prefix`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/allowlist/${n.prefixId??`<prefixId>`}`,pathParams:{prefixId:String(n.prefixId??``)},bodyKind:`none`});return}let a=await r(n),o=n.local?d:await e(a);if(n.accountId=o,!await t({force:!!n.force})){process.stderr.write(`Aborted.
|
|
5
|
-
`);return}s(await l(`Deleting`,async()=>a.magicTransit.advancedTCPProtection.configs.allowlist.delete.allowlist.prefix(o,n.prefixId)),{successLabel:`Deleted`})}},I={command:`allowlist`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(F).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function L(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 R={command:`account`,describe:`Delete all allowlist prefixes for an account.`,builder:L,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs allowlist delete for account`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/allowlist`,pathParams:{},bodyKind:`none`});return}let a=await r(n),o=n.local?d:await e(a);if(n.accountId=o,!await t({force:!!n.force})){process.stderr.write(`Aborted.
|
|
6
|
-
`);return}s(await l(`Deleting`,async()=>a.magicTransit.advancedTCPProtection.configs.allowlist.delete.for.account(o)),{successLabel:`Deleted`})}},z={command:`for`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},B={command:`delete`,describe:`Operations for advanced-tcp-protection.configs.allowlist.delete`,builder:e=>e.command(I).command(z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function V(e){return e.positional(`prefixId`,{type:`string`,description:`The UUID of the allowlist prefix.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const H={command:`get <prefixId>`,describe:`Get an allowlist prefix specified by the given UUID.`,builder:V,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs allowlist get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/allowlist/${t.prefixId??`<prefixId>`}`,pathParams:{prefixId:String(t.prefixId??``)},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.magicTransit.advancedTCPProtection.configs.allowlist.get(a,t.prefixId)),{successLabel:`Loaded`})}};function U(e){return e.option(`page`,{type:`number`,description:`The page number for pagination. Defaults to 1.`}).option(`per-page`,{type:`number`,description:`The number of items per page. Must be between 10 and 1000. Defaults to 25.`}).option(`order`,{type:`string`,description:`The field to order by. Defaults to 'prefix'.`}).option(`direction`,{type:`string`,description:`The direction of ordering (ASC or DESC). Defaults to 'ASC'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const W={command:`list`,describe:`List all allowlist prefixes for an account.`,builder:U,handler:async t=>{let n={page:t.page,per_page:t.perPage,order:t.order,direction:t.direction};if(t.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs allowlist list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/allowlist`,pathParams:{},query:n,bodyKind:`none`});return}let a=await r(t),o=t.local?d:await e(a);t.accountId=o,s(await l(`Loading`,async()=>a.magicTransit.advancedTCPProtection.configs.allowlist.list(o,n)),{successLabel:`Loaded`})}};function G(e){return e.positional(`prefixId`,{type:`string`,description:`The UUID of the allowlist prefix to update.`,demandOption:!0}).option(`comment`,{type:`string`,description:`A comment describing the allowlist prefix. Optional.`}).option(`enabled`,{type:`boolean`,description:`Whether to enable the allowlist prefix into effect. Optional.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The updates to apply to the allowlist prefix.`})}const K={command:`update <prefixId>`,describe:`Update an allowlist prefix specified by the given UUID.`,builder:G,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs allowlist update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/allowlist/${t.prefixId??`<prefixId>`}`,pathParams:{prefixId:String(t.prefixId??``)},bodyKind:`json`,body:{comment:t.comment,enabled:t.enabled,body:t.body}});return}let n=await r(t),f=t.local?d:await e(n);if(t.accountId=f,t.body){let e=o(t.body);s(await l(`Updating`,async()=>n.patch(`/accounts/${f}/magic/advanced_tcp_protection/configs/allowlist/${t.prefixId}`,{body:e})),{successLabel:`Updated`});return}let p={};t.comment!==void 0&&a(p,[`comment`],u(t.comment,`comment`,`text`)),t.enabled!==void 0&&a(p,[`enabled`],t.enabled),s(await l(`Updating`,async()=>n.patch(`/accounts/${f}/magic/advanced_tcp_protection/configs/allowlist/${t.prefixId}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}},q={command:`allowlist`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(N).command(H).command(W).command(K).command(B).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function J(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The list of new prefixes to create.`})}const Y={command:`create`,describe:`Create multiple prefixes for an account.`,builder:J,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs prefixes bulk create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/prefixes/bulk`,pathParams:{},bodyKind:`json`,body:{body:t.body}});return}let n=await r(t),a=t.local?d:await e(n);if(t.accountId=a,t.body){let e=o(t.body);s(await l(`Creating`,async()=>n.post(`/accounts/${a}/magic/advanced_tcp_protection/configs/prefixes/bulk`,{body:e})),{successLabel:`Created`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},X={command:`bulk`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(Y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Z(e){return e.option(`comment`,{type:`string`,description:`A comment describing the prefix.`}).option(`excluded`,{type:`boolean`,description:`Whether to exclude the prefix from protection.`}).option(`prefix`,{type:`string`,description:`The prefix to add in CIDR format.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The new prefix to create.`})}const Q={command:`create`,describe:`Create a prefix for an account.`,builder:Z,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs prefixes create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/prefixes`,pathParams:{},bodyKind:`json`,body:{comment:t.comment,excluded:t.excluded,prefix:t.prefix,body:t.body}});return}let f=await r(t),p=t.local?d:await e(f);if(t.accountId=p,t.body){let e=o(t.body);s(await l(`Creating`,async()=>f.post(`/accounts/${p}/magic/advanced_tcp_protection/configs/prefixes`,{body:e})),{successLabel:`Created`});return}if(t.comment===void 0&&(t.comment=await n(`comment`,`A comment describing the prefix.`)),t.excluded===void 0)throw Error(`--excluded is required (or pass --body with this field set).`);t.prefix===void 0&&(t.prefix=await n(`prefix`,`The prefix to add in CIDR format.`));let m={};t.comment!==void 0&&a(m,[`comment`],u(t.comment,`comment`,`text`)),t.excluded!==void 0&&a(m,[`excluded`],t.excluded),t.prefix!==void 0&&a(m,[`prefix`],u(t.prefix,`prefix`,`text`)),s(await l(`Creating`,async()=>f.post(`/accounts/${p}/magic/advanced_tcp_protection/configs/prefixes`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function ne(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const re={command:`account`,describe:`Delete all prefixes for an account.`,builder:ne,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs prefixes delete for account`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/prefixes`,pathParams:{},bodyKind:`none`});return}let a=await r(n),o=n.local?d:await e(a);if(n.accountId=o,!await t({force:!!n.force})){process.stderr.write(`Aborted.
|
|
7
|
-
`);return}s(await l(`Deleting`,async()=>a.magicTransit.advancedTCPProtection.configs.prefixes.delete.for.account(o)),{successLabel:`Deleted`})}},ie={command:`for`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(re).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ae(e){return e.positional(`prefixId`,{type:`string`,description:`The UUID of the prefix to delete.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const oe={command:`prefix <prefixId>`,describe:`Delete the prefix for an account given a UUID.`,builder:ae,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs prefixes delete prefix`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/prefixes/${n.prefixId??`<prefixId>`}`,pathParams:{prefixId:String(n.prefixId??``)},bodyKind:`none`});return}let a=await r(n),o=n.local?d:await e(a);if(n.accountId=o,!await t({force:!!n.force})){process.stderr.write(`Aborted.
|
|
8
|
-
`);return}s(await l(`Deleting`,async()=>a.magicTransit.advancedTCPProtection.configs.prefixes.delete.prefix(o,n.prefixId)),{successLabel:`Deleted`})}},se={command:`delete`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(oe).command(ie).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ce(e){return e.positional(`prefixId`,{type:`string`,description:`The UUID of the prefix.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const le={command:`get <prefixId>`,describe:`Get a prefix specified by the given UUID.`,builder:ce,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs prefixes get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/prefixes/${t.prefixId??`<prefixId>`}`,pathParams:{prefixId:String(t.prefixId??``)},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.magicTransit.advancedTCPProtection.configs.prefixes.get(a,t.prefixId)),{successLabel:`Loaded`})}};function ue(e){return e.option(`page`,{type:`number`,description:`The page number for pagination. Defaults to 1.`}).option(`per-page`,{type:`number`,description:`The number of items per page. Must be between 10 and 1000. Defaults to 25.`}).option(`order`,{type:`string`,description:`The field to order by. Defaults to 'prefix'.`}).option(`direction`,{type:`string`,description:`The direction of ordering (ASC or DESC). Defaults to 'ASC'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const de={command:`list`,describe:`List all prefixes for an account.`,builder:ue,handler:async t=>{let n={page:t.page,per_page:t.perPage,order:t.order,direction:t.direction};if(t.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs prefixes list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/prefixes`,pathParams:{},query:n,bodyKind:`none`});return}let a=await r(t),o=t.local?d:await e(a);t.accountId=o,s(await l(`Loading`,async()=>a.magicTransit.advancedTCPProtection.configs.prefixes.list(o,n)),{successLabel:`Loaded`})}};function fe(e){return e.positional(`prefixId`,{type:`string`,description:`The UUID of the prefix to update.`,demandOption:!0}).option(`comment`,{type:`string`,description:`A new comment for the prefix. Optional.`}).option(`excluded`,{type:`boolean`,description:`Whether to exclude the prefix from protection. Optional.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The updates to apply to the prefix.`})}const pe={command:`update <prefixId>`,describe:`Update a prefix specified by the given UUID.`,builder:fe,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs prefixes update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/prefixes/${t.prefixId??`<prefixId>`}`,pathParams:{prefixId:String(t.prefixId??``)},bodyKind:`json`,body:{comment:t.comment,excluded:t.excluded,body:t.body}});return}let n=await r(t),f=t.local?d:await e(n);if(t.accountId=f,t.body){let e=o(t.body);s(await l(`Updating`,async()=>n.patch(`/accounts/${f}/magic/advanced_tcp_protection/configs/prefixes/${t.prefixId}`,{body:e})),{successLabel:`Updated`});return}let p={};t.comment!==void 0&&a(p,[`comment`],u(t.comment,`comment`,`text`)),t.excluded!==void 0&&a(p,[`excluded`],t.excluded),s(await l(`Updating`,async()=>n.patch(`/accounts/${f}/magic/advanced_tcp_protection/configs/prefixes/${t.prefixId}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}},me={command:`prefixes`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(Q).command(le).command(de).command(pe).command(X).command(se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function he(e){return e.option(`expression`,{type:`string`,description:`The filter expression.`}).option(`mode`,{type:`string`,description:`The filter's mode. Must be one of 'enabled', 'disabled', 'monitoring'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The new filter to create.`})}const ge={command:`create`,describe:`Create a SYN Protection filter for an account.`,builder:he,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs syn protection filters create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/filters`,pathParams:{},bodyKind:`json`,body:{expression:t.expression,mode:t.mode,body:t.body}});return}let f=await r(t),p=t.local?d:await e(f);if(t.accountId=p,t.body){let e=o(t.body);s(await l(`Creating`,async()=>f.post(`/accounts/${p}/magic/advanced_tcp_protection/configs/syn_protection/filters`,{body:e})),{successLabel:`Created`});return}t.expression===void 0&&(t.expression=await n(`expression`,`The filter expression.`)),t.mode===void 0&&(t.mode=await n(`mode`,`The filter's mode. Must be one of 'enabled', 'disabled', 'monitoring'.`));let m={};t.expression!==void 0&&a(m,[`expression`],u(t.expression,`expression`,`text`)),t.mode!==void 0&&a(m,[`mode`],u(t.mode,`mode`,`text`)),s(await l(`Creating`,async()=>f.post(`/accounts/${p}/magic/advanced_tcp_protection/configs/syn_protection/filters`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function _e(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 ve={command:`account`,describe:`Delete all SYN Protection filters for an account.`,builder:_e,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs syn protection filters delete for account`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/filters`,pathParams:{},bodyKind:`none`});return}let a=await r(n),o=n.local?d:await e(a);if(n.accountId=o,!await t({force:!!n.force})){process.stderr.write(`Aborted.
|
|
9
|
-
`);return}s(await l(`Deleting`,async()=>a.magicTransit.advancedTCPProtection.configs.syn.protection.filters.delete.for.account(o)),{successLabel:`Deleted`})}},ye={command:`for`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(ve).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function be(e){return e.positional(`filterId`,{type:`string`,description:`The UUID of the filter to delete.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const xe={command:`filter <filterId>`,describe:`Delete a SYN Protection filter specified by the given UUID.`,builder:be,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs syn protection filters delete protection filter`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/filters/${n.filterId??`<filterId>`}`,pathParams:{filterId:String(n.filterId??``)},bodyKind:`none`});return}let a=await r(n),o=n.local?d:await e(a);if(n.accountId=o,!await t({force:!!n.force})){process.stderr.write(`Aborted.
|
|
10
|
-
`);return}s(await l(`Deleting`,async()=>a.magicTransit.advancedTCPProtection.configs.syn.protection.filters.delete.protection.filter(o,n.filterId)),{successLabel:`Deleted`})}},Se={command:`protection`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(xe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ce={command:`delete`,describe:`Operations for advanced-tcp-protection.configs.syn.protection.filters.delete`,builder:e=>e.command(ye).command(Se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function we(e){return e.positional(`filterId`,{type:`string`,description:`The UUID of the filter to retrieve.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Te={command:`get <filterId>`,describe:`Get a SYN Protection filter specified by the given UUID.`,builder:we,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs syn protection filters get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/filters/${t.filterId??`<filterId>`}`,pathParams:{filterId:String(t.filterId??``)},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.magicTransit.advancedTCPProtection.configs.syn.protection.filters.get(a,t.filterId)),{successLabel:`Loaded`})}};function Ee(e){return e.option(`mode`,{type:`string`,description:`The mode of the filters to get. Optional. Valid values: 'enabled', 'disabled', 'monitoring'.`}).option(`page`,{type:`number`,description:`The page number for pagination. Defaults to 1.`}).option(`per-page`,{type:`number`,description:`The number of items per page. Must be between 10 and 1000. Defaults to 25.`}).option(`order`,{type:`string`,description:`The field to order by. Defaults to 'prefix'.`}).option(`direction`,{type:`string`,description:`The direction of ordering (ASC or DESC). Defaults to 'ASC'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const De={command:`list`,describe:`List all SYN Protection filters for an account.`,builder:Ee,handler:async t=>{let n={mode:t.mode,page:t.page,per_page:t.perPage,order:t.order,direction:t.direction};if(t.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs syn protection filters list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/filters`,pathParams:{},query:n,bodyKind:`none`});return}let a=await r(t),o=t.local?d:await e(a);t.accountId=o,s(await l(`Loading`,async()=>a.magicTransit.advancedTCPProtection.configs.syn.protection.filters.list(o,n)),{successLabel:`Loaded`})}};function Oe(e){return e.positional(`filterId`,{type:`string`,description:`The UUID of the filter to update.`,demandOption:!0}).option(`expression`,{type:`string`,description:`The new filter expression. Optional.`}).option(`mode`,{type:`string`,description:`The new mode for the filter. Optional. Must be one of 'enabled', 'disabled', 'monitoring'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The updates to apply to the filter.`})}const ke={command:`update <filterId>`,describe:`Update a SYN Protection filter specified by the given UUID.`,builder:Oe,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs syn protection filters update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/filters/${t.filterId??`<filterId>`}`,pathParams:{filterId:String(t.filterId??``)},bodyKind:`json`,body:{expression:t.expression,mode:t.mode,body:t.body}});return}let n=await r(t),f=t.local?d:await e(n);if(t.accountId=f,t.body){let e=o(t.body);s(await l(`Updating`,async()=>n.patch(`/accounts/${f}/magic/advanced_tcp_protection/configs/syn_protection/filters/${t.filterId}`,{body:e})),{successLabel:`Updated`});return}let p={};t.expression!==void 0&&a(p,[`expression`],u(t.expression,`expression`,`text`)),t.mode!==void 0&&a(p,[`mode`],u(t.mode,`mode`,`text`)),s(await l(`Updating`,async()=>n.patch(`/accounts/${f}/magic/advanced_tcp_protection/configs/syn_protection/filters/${t.filterId}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}},Ae={command:`filters`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(ge).command(Te).command(De).command(ke).command(Ce).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function je(e){return e.option(`burst-sensitivity`,{type:`string`,description:`The burst sensitivity. Must be one of 'low', 'medium', 'high'.`}).option(`mitigation-type`,{type:`string`,description:`The type of mitigation. Must be one of 'challenge' or 'retransmit'. Optional. Defaults to 'challenge'.`}).option(`mode`,{type:`string`,description:`The mode for SYN Protection. Must be one of 'enabled', 'disabled', 'monitoring'.`}).option(`name`,{type:`string`,description:`The name of the SYN Protection rule. Value is relative to the 'scope' setting. For 'global' scope, name should be 'global'. For either the 'region' or 'datacenter' scope, name should be the actual name of the region or datacenter, e.g., 'wnam' or 'lax'.`}).option(`rate-sensitivity`,{type:`string`,description:`The rate sensitivity. Must be one of 'low', 'medium', 'high'.`}).option(`scope`,{type:`string`,description:`The scope for the SYN Protection rule. Must be one of 'global', 'region', or 'datacenter'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The new SYN Protection rule to add.`})}const Me={command:`create`,describe:`Create a SYN Protection rule for an account.`,builder:je,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs syn protection rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/rules`,pathParams:{},bodyKind:`json`,body:{burstSensitivity:t.burstSensitivity,mitigationType:t.mitigationType,mode:t.mode,name:t.name,rateSensitivity:t.rateSensitivity,scope:t.scope,body:t.body}});return}let f=await r(t),p=t.local?d:await e(f);if(t.accountId=p,t.body){let e=o(t.body);s(await l(`Creating`,async()=>f.post(`/accounts/${p}/magic/advanced_tcp_protection/configs/syn_protection/rules`,{body:e})),{successLabel:`Created`});return}t.burstSensitivity===void 0&&(t.burstSensitivity=await n(`burst-sensitivity`,`The burst sensitivity. Must be one of 'low', 'medium', 'high'.`)),t.mode===void 0&&(t.mode=await n(`mode`,`The mode for SYN Protection. Must be one of 'enabled', 'disabled', 'monitoring'.`)),t.name===void 0&&(t.name=await n(`name`,`The name of the SYN Protection rule. Value is relative to the 'scope' setting. For 'global' scope, name should be 'global'. For either the 'region' or 'datacenter' scope, name should be the actual name of the region or datacenter, e.g., 'wnam' or 'lax'.`)),t.rateSensitivity===void 0&&(t.rateSensitivity=await n(`rate-sensitivity`,`The rate sensitivity. Must be one of 'low', 'medium', 'high'.`)),t.scope===void 0&&(t.scope=await n(`scope`,`The scope for the SYN Protection rule. Must be one of 'global', 'region', or 'datacenter'.`));let m={};t.burstSensitivity!==void 0&&a(m,[`burst_sensitivity`],u(t.burstSensitivity,`burstSensitivity`,`text`)),t.mitigationType!==void 0&&a(m,[`mitigation_type`],u(t.mitigationType,`mitigationType`,`text`)),t.mode!==void 0&&a(m,[`mode`],u(t.mode,`mode`,`text`)),t.name!==void 0&&a(m,[`name`],u(t.name,`name`,`text`)),t.rateSensitivity!==void 0&&a(m,[`rate_sensitivity`],u(t.rateSensitivity,`rateSensitivity`,`text`)),t.scope!==void 0&&a(m,[`scope`],u(t.scope,`scope`,`text`)),s(await l(`Creating`,async()=>f.post(`/accounts/${p}/magic/advanced_tcp_protection/configs/syn_protection/rules`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function Ne(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 Pe={command:`account`,describe:`Delete all SYN Protection rules for an account.`,builder:Ne,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs syn protection rules delete for account`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/rules`,pathParams:{},bodyKind:`none`});return}let a=await r(n),o=n.local?d:await e(a);if(n.accountId=o,!await t({force:!!n.force})){process.stderr.write(`Aborted.
|
|
11
|
-
`);return}s(await l(`Deleting`,async()=>a.magicTransit.advancedTCPProtection.configs.syn.protection.rules.delete.for.account(o)),{successLabel:`Deleted`})}},Fe={command:`for`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(Pe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ie(e){return e.positional(`ruleId`,{type:`string`,description:`The UUID of the SYN Protection rule to delete.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Le={command:`rule <ruleId>`,describe:`Delete a SYN Protection rule specified by the given UUID.`,builder:Ie,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs syn protection rules delete protection rule`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/rules/${n.ruleId??`<ruleId>`}`,pathParams:{ruleId:String(n.ruleId??``)},bodyKind:`none`});return}let a=await r(n),o=n.local?d:await e(a);if(n.accountId=o,!await t({force:!!n.force})){process.stderr.write(`Aborted.
|
|
12
|
-
`);return}s(await l(`Deleting`,async()=>a.magicTransit.advancedTCPProtection.configs.syn.protection.rules.delete.protection.rule(o,n.ruleId)),{successLabel:`Deleted`})}},Re={command:`protection`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(Le).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ze={command:`delete`,describe:`Operations for advanced-tcp-protection.configs.syn.protection.rules.delete`,builder:e=>e.command(Fe).command(Re).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Be(e){return e.positional(`ruleId`,{type:`string`,description:`The UUID of the SYN Protection rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ve={command:`get <ruleId>`,describe:`Get a SYN Protection rule specified by the given UUID.`,builder:Be,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs syn protection rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/rules/${t.ruleId??`<ruleId>`}`,pathParams:{ruleId:String(t.ruleId??``)},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.magicTransit.advancedTCPProtection.configs.syn.protection.rules.get(a,t.ruleId)),{successLabel:`Loaded`})}};function He(e){return e.option(`page`,{type:`number`,description:`The page number for pagination. Defaults to 1.`}).option(`per-page`,{type:`number`,description:`The number of items per page. Must be between 10 and 1000. Defaults to 25.`}).option(`order`,{type:`string`,description:`The field to order by. Defaults to 'prefix'.`}).option(`direction`,{type:`string`,description:`The direction of ordering (ASC or DESC). Defaults to 'ASC'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ue={command:`list`,describe:`List all SYN Protection rules for an account.`,builder:He,handler:async t=>{let n={page:t.page,per_page:t.perPage,order:t.order,direction:t.direction};if(t.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs syn protection rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/rules`,pathParams:{},query:n,bodyKind:`none`});return}let a=await r(t),o=t.local?d:await e(a);t.accountId=o,s(await l(`Loading`,async()=>a.magicTransit.advancedTCPProtection.configs.syn.protection.rules.list(o,n)),{successLabel:`Loaded`})}};function We(e){return e.positional(`ruleId`,{type:`string`,description:`The UUID of the SYN Protection rule to update.`,demandOption:!0}).option(`burst-sensitivity`,{type:`string`,description:`The new burst sensitivity. Optional. Must be one of 'low', 'medium', 'high'.`}).option(`mitigation-type`,{type:`string`,description:`The new mitigation type. Optional. Must be one of 'challenge' or 'retransmit'.`}).option(`mode`,{type:`string`,description:`The new mode for SYN Protection. Optional. Must be one of 'enabled', 'disabled', 'monitoring'.`}).option(`rate-sensitivity`,{type:`string`,description:`The new rate sensitivity. Optional. Must be one of 'low', 'medium', 'high'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The fields to update on the SYN Protection rule.`})}const Ge={command:`update <ruleId>`,describe:`Update a SYN Protection rule specified by the given UUID.`,builder:We,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs syn protection rules update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/syn_protection/rules/${t.ruleId??`<ruleId>`}`,pathParams:{ruleId:String(t.ruleId??``)},bodyKind:`json`,body:{burstSensitivity:t.burstSensitivity,mitigationType:t.mitigationType,mode:t.mode,rateSensitivity:t.rateSensitivity,body:t.body}});return}let n=await r(t),f=t.local?d:await e(n);if(t.accountId=f,t.body){let e=o(t.body);s(await l(`Updating`,async()=>n.patch(`/accounts/${f}/magic/advanced_tcp_protection/configs/syn_protection/rules/${t.ruleId}`,{body:e})),{successLabel:`Updated`});return}let p={};t.burstSensitivity!==void 0&&a(p,[`burst_sensitivity`],u(t.burstSensitivity,`burstSensitivity`,`text`)),t.mitigationType!==void 0&&a(p,[`mitigation_type`],u(t.mitigationType,`mitigationType`,`text`)),t.mode!==void 0&&a(p,[`mode`],u(t.mode,`mode`,`text`)),t.rateSensitivity!==void 0&&a(p,[`rate_sensitivity`],u(t.rateSensitivity,`rateSensitivity`,`text`)),s(await l(`Updating`,async()=>n.patch(`/accounts/${f}/magic/advanced_tcp_protection/configs/syn_protection/rules/${t.ruleId}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}},Ke={command:`rules`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(Me).command(Ve).command(Ue).command(Ge).command(ze).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},qe={command:`protection`,describe:`Operations for advanced-tcp-protection.configs.syn.protection`,builder:e=>e.command(Ae).command(Ke).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Je={command:`syn`,describe:`Operations for advanced-tcp-protection.configs.syn`,builder:e=>e.command(qe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ye(e){return e.option(`expression`,{type:`string`,description:`The filter expression.`}).option(`mode`,{type:`string`,description:`The filter's mode. Must be one of 'enabled', 'disabled', 'monitoring'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The new filter to create.`})}const Xe={command:`create`,describe:`Create a TCP Flow Protection filter for an account.`,builder:Ye,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection filters create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters`,pathParams:{},bodyKind:`json`,body:{expression:t.expression,mode:t.mode,body:t.body}});return}let f=await r(t),p=t.local?d:await e(f);if(t.accountId=p,t.body){let e=o(t.body);s(await l(`Creating`,async()=>f.post(`/accounts/${p}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters`,{body:e})),{successLabel:`Created`});return}t.expression===void 0&&(t.expression=await n(`expression`,`The filter expression.`)),t.mode===void 0&&(t.mode=await n(`mode`,`The filter's mode. Must be one of 'enabled', 'disabled', 'monitoring'.`));let m={};t.expression!==void 0&&a(m,[`expression`],u(t.expression,`expression`,`text`)),t.mode!==void 0&&a(m,[`mode`],u(t.mode,`mode`,`text`)),s(await l(`Creating`,async()=>f.post(`/accounts/${p}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function Ze(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 Qe={command:`account`,describe:`Delete all TCP Flow Protection filters for an account.`,builder:Ze,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection filters delete for account`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters`,pathParams:{},bodyKind:`none`});return}let a=await r(n),o=n.local?d:await e(a);if(n.accountId=o,!await t({force:!!n.force})){process.stderr.write(`Aborted.
|
|
13
|
-
`);return}s(await l(`Deleting`,async()=>a.magicTransit.advancedTCPProtection.configs.tcp.flow.protection.filters.delete.for.account(o)),{successLabel:`Deleted`})}},$e={command:`for`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(Qe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function et(e){return e.positional(`filterId`,{type:`string`,description:`The UUID of the filter to delete.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const tt={command:`filter <filterId>`,describe:`Delete a TCP Flow Protection filter specified by the given UUID.`,builder:et,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection filters delete protection filter`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters/${n.filterId??`<filterId>`}`,pathParams:{filterId:String(n.filterId??``)},bodyKind:`none`});return}let a=await r(n),o=n.local?d:await e(a);if(n.accountId=o,!await t({force:!!n.force})){process.stderr.write(`Aborted.
|
|
14
|
-
`);return}s(await l(`Deleting`,async()=>a.magicTransit.advancedTCPProtection.configs.tcp.flow.protection.filters.delete.protection.filter(o,n.filterId)),{successLabel:`Deleted`})}},nt={command:`protection`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(tt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},rt={command:`delete`,describe:`Operations for advanced-tcp-protection.configs.tcp.flow.protection.filters.delete`,builder:e=>e.command($e).command(nt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function it(e){return e.positional(`filterId`,{type:`string`,description:`The UUID of the filter to retrieve.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const at={command:`get <filterId>`,describe:`Get a TCP Flow Protection filter specified by the given UUID.`,builder:it,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection filters get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters/${t.filterId??`<filterId>`}`,pathParams:{filterId:String(t.filterId??``)},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.magicTransit.advancedTCPProtection.configs.tcp.flow.protection.filters.get(a,t.filterId)),{successLabel:`Loaded`})}};function ot(e){return e.option(`mode`,{type:`string`,description:`The mode of the filters to get. Optional. Valid values: 'enabled', 'disabled', 'monitoring'.`}).option(`page`,{type:`number`,description:`The page number for pagination. Defaults to 1.`}).option(`per-page`,{type:`number`,description:`The number of items per page. Must be between 10 and 1000. Defaults to 25.`}).option(`order`,{type:`string`,description:`The field to order by. Defaults to 'prefix'.`}).option(`direction`,{type:`string`,description:`The direction of ordering (ASC or DESC). Defaults to 'ASC'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const st={command:`list`,describe:`List all TCP Flow Protection filters for an account.`,builder:ot,handler:async t=>{let n={mode:t.mode,page:t.page,per_page:t.perPage,order:t.order,direction:t.direction};if(t.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection filters list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters`,pathParams:{},query:n,bodyKind:`none`});return}let a=await r(t),o=t.local?d:await e(a);t.accountId=o,s(await l(`Loading`,async()=>a.magicTransit.advancedTCPProtection.configs.tcp.flow.protection.filters.list(o,n)),{successLabel:`Loaded`})}};function ct(e){return e.positional(`filterId`,{type:`string`,description:`The UUID of the filter to update.`,demandOption:!0}).option(`expression`,{type:`string`,description:`The new filter expression. Optional.`}).option(`mode`,{type:`string`,description:`The new mode for the filter. Optional. Must be one of 'enabled', 'disabled', 'monitoring'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The updates to apply to the filter.`})}const lt={command:`update <filterId>`,describe:`Update a TCP Flow Protection filter specified by the given UUID.`,builder:ct,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection filters update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters/${t.filterId??`<filterId>`}`,pathParams:{filterId:String(t.filterId??``)},bodyKind:`json`,body:{expression:t.expression,mode:t.mode,body:t.body}});return}let n=await r(t),f=t.local?d:await e(n);if(t.accountId=f,t.body){let e=o(t.body);s(await l(`Updating`,async()=>n.patch(`/accounts/${f}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters/${t.filterId}`,{body:e})),{successLabel:`Updated`});return}let p={};t.expression!==void 0&&a(p,[`expression`],u(t.expression,`expression`,`text`)),t.mode!==void 0&&a(p,[`mode`],u(t.mode,`mode`,`text`)),s(await l(`Updating`,async()=>n.patch(`/accounts/${f}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters/${t.filterId}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}},ut={command:`filters`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(Xe).command(at).command(st).command(lt).command(rt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function dt(e){return e.option(`burst-sensitivity`,{type:`string`,description:`The burst sensitivity. Must be one of 'low', 'medium', 'high'.`}).option(`mode`,{type:`string`,description:`The mode for the TCP Flow Protection. Must be one of 'enabled', 'disabled', 'monitoring'.`}).option(`name`,{type:`string`,description:`The name of the TCP Flow Protection rule. Value is relative to the 'scope' setting. For 'global' scope, name should be 'global'. For either the 'region' or 'datacenter' scope, name should be the actual name of the region or datacenter, e.g., 'wnam' or 'lax'.`}).option(`rate-sensitivity`,{type:`string`,description:`The rate sensitivity. Must be one of 'low', 'medium', 'high'.`}).option(`scope`,{type:`string`,description:`The scope for the TCP Flow Protection rule.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The new TCP Flow Protection rule.`})}const ft={command:`create`,describe:`Create a TCP Flow Protection rule for an account.`,builder:dt,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules`,pathParams:{},bodyKind:`json`,body:{burstSensitivity:t.burstSensitivity,mode:t.mode,name:t.name,rateSensitivity:t.rateSensitivity,scope:t.scope,body:t.body}});return}let f=await r(t),p=t.local?d:await e(f);if(t.accountId=p,t.body){let e=o(t.body);s(await l(`Creating`,async()=>f.post(`/accounts/${p}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules`,{body:e})),{successLabel:`Created`});return}t.burstSensitivity===void 0&&(t.burstSensitivity=await n(`burst-sensitivity`,`The burst sensitivity. Must be one of 'low', 'medium', 'high'.`)),t.mode===void 0&&(t.mode=await n(`mode`,`The mode for the TCP Flow Protection. Must be one of 'enabled', 'disabled', 'monitoring'.`)),t.name===void 0&&(t.name=await n(`name`,`The name of the TCP Flow Protection rule. Value is relative to the 'scope' setting. For 'global' scope, name should be 'global'. For either the 'region' or 'datacenter' scope, name should be the actual name of the region or datacenter, e.g., 'wnam' or 'lax'.`)),t.rateSensitivity===void 0&&(t.rateSensitivity=await n(`rate-sensitivity`,`The rate sensitivity. Must be one of 'low', 'medium', 'high'.`)),t.scope===void 0&&(t.scope=await n(`scope`,`The scope for the TCP Flow Protection rule.`));let m={};t.burstSensitivity!==void 0&&a(m,[`burst_sensitivity`],u(t.burstSensitivity,`burstSensitivity`,`text`)),t.mode!==void 0&&a(m,[`mode`],u(t.mode,`mode`,`text`)),t.name!==void 0&&a(m,[`name`],u(t.name,`name`,`text`)),t.rateSensitivity!==void 0&&a(m,[`rate_sensitivity`],u(t.rateSensitivity,`rateSensitivity`,`text`)),t.scope!==void 0&&a(m,[`scope`],u(t.scope,`scope`,`text`)),s(await l(`Creating`,async()=>f.post(`/accounts/${p}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function pt(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 mt={command:`account`,describe:`Delete all TCP Flow Protection rules for an account.`,builder:pt,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection rules delete for account`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules`,pathParams:{},bodyKind:`none`});return}let a=await r(n),o=n.local?d:await e(a);if(n.accountId=o,!await t({force:!!n.force})){process.stderr.write(`Aborted.
|
|
15
|
-
`);return}s(await l(`Deleting`,async()=>a.magicTransit.advancedTCPProtection.configs.tcp.flow.protection.rules.delete.for.account(o)),{successLabel:`Deleted`})}},ht={command:`for`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(mt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function gt(e){return e.positional(`ruleId`,{type:`string`,description:`The UUID of the TCP Flow Protection rule to delete.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const _t={command:`rule <ruleId>`,describe:`Delete a TCP Flow Protection rule specified by the given UUID.`,builder:gt,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection rules delete protection rule`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules/${n.ruleId??`<ruleId>`}`,pathParams:{ruleId:String(n.ruleId??``)},bodyKind:`none`});return}let a=await r(n),o=n.local?d:await e(a);if(n.accountId=o,!await t({force:!!n.force})){process.stderr.write(`Aborted.
|
|
16
|
-
`);return}s(await l(`Deleting`,async()=>a.magicTransit.advancedTCPProtection.configs.tcp.flow.protection.rules.delete.protection.rule(o,n.ruleId)),{successLabel:`Deleted`})}},vt={command:`protection`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(_t).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},yt={command:`delete`,describe:`Operations for advanced-tcp-protection.configs.tcp.flow.protection.rules.delete`,builder:e=>e.command(ht).command(vt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function bt(e){return e.positional(`ruleId`,{type:`string`,description:`The UUID of the TCP Flow Protection rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const xt={command:`get <ruleId>`,describe:`Get a TCP Flow Protection rule specified by the given UUID.`,builder:bt,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules/${t.ruleId??`<ruleId>`}`,pathParams:{ruleId:String(t.ruleId??``)},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.magicTransit.advancedTCPProtection.configs.tcp.flow.protection.rules.get(a,t.ruleId)),{successLabel:`Loaded`})}};function St(e){return e.option(`page`,{type:`number`,description:`The page number for pagination. Defaults to 1.`}).option(`per-page`,{type:`number`,description:`The number of items per page. Must be between 10 and 1000. Defaults to 25.`}).option(`order`,{type:`string`,description:`The field to order by. Defaults to 'prefix'.`}).option(`direction`,{type:`string`,description:`The direction of ordering (ASC or DESC). Defaults to 'ASC'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ct={command:`list`,describe:`List all TCP Flow Protection rules for an account.`,builder:St,handler:async t=>{let n={page:t.page,per_page:t.perPage,order:t.order,direction:t.direction};if(t.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules`,pathParams:{},query:n,bodyKind:`none`});return}let a=await r(t),o=t.local?d:await e(a);t.accountId=o,s(await l(`Loading`,async()=>a.magicTransit.advancedTCPProtection.configs.tcp.flow.protection.rules.list(o,n)),{successLabel:`Loaded`})}};function wt(e){return e.positional(`ruleId`,{type:`string`,description:`The UUID of the TCP Flow Protection rule to update.`,demandOption:!0}).option(`burst-sensitivity`,{type:`string`,description:`The new burst sensitivity. Optional. Must be one of 'low', 'medium', 'high'.`}).option(`mode`,{type:`string`,description:`The new mode for TCP Flow Protection. Optional. Must be one of 'enabled', 'disabled', 'monitoring'.`}).option(`rate-sensitivity`,{type:`string`,description:`The new rate sensitivity. Optional. Must be one of 'low', 'medium', 'high'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The updates to apply to the TCP Flow Protection rule.`})}const Tt={command:`update <ruleId>`,describe:`Update a TCP Flow Protection rule specified by the given UUID.`,builder:wt,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs tcp flow protection rules update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules/${t.ruleId??`<ruleId>`}`,pathParams:{ruleId:String(t.ruleId??``)},bodyKind:`json`,body:{burstSensitivity:t.burstSensitivity,mode:t.mode,rateSensitivity:t.rateSensitivity,body:t.body}});return}let n=await r(t),f=t.local?d:await e(n);if(t.accountId=f,t.body){let e=o(t.body);s(await l(`Updating`,async()=>n.patch(`/accounts/${f}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules/${t.ruleId}`,{body:e})),{successLabel:`Updated`});return}let p={};t.burstSensitivity!==void 0&&a(p,[`burst_sensitivity`],u(t.burstSensitivity,`burstSensitivity`,`text`)),t.mode!==void 0&&a(p,[`mode`],u(t.mode,`mode`,`text`)),t.rateSensitivity!==void 0&&a(p,[`rate_sensitivity`],u(t.rateSensitivity,`rateSensitivity`,`text`)),s(await l(`Updating`,async()=>n.patch(`/accounts/${f}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules/${t.ruleId}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}},Et={command:`rules`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(ft).command(xt).command(Ct).command(Tt).command(yt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Dt={command:`protection`,describe:`Operations for advanced-tcp-protection.configs.tcp.flow.protection`,builder:e=>e.command(ut).command(Et).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ot={command:`flow`,describe:`Operations for advanced-tcp-protection.configs.tcp.flow`,builder:e=>e.command(Dt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function kt(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const At={command:`get`,describe:`Get the protection status of the account.`,builder:kt,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs tcp protection status get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_protection_status`,pathParams:{},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.magicTransit.advancedTCPProtection.configs.tcp.protection.status.get(a)),{successLabel:`Loaded`})}};function jt(e){return e.option(`enabled`,{type:`boolean`,description:`Enables or disables protection.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`The update to apply to the protection status.`})}const Mt={command:`update`,describe:`Update the protection status of the account.`,builder:jt,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit advanced-tcp-protection configs tcp protection status update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/advanced_tcp_protection/configs/tcp_protection_status`,pathParams:{},bodyKind:`json`,body:{enabled:t.enabled,body:t.body}});return}let n=await r(t),u=t.local?d:await e(n);if(t.accountId=u,t.body){let e=o(t.body);s(await l(`Updating`,async()=>n.patch(`/accounts/${u}/magic/advanced_tcp_protection/configs/tcp_protection_status`,{body:e})),{successLabel:`Updated`});return}if(t.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);let f={};t.enabled!==void 0&&a(f,[`enabled`],t.enabled),s(await l(`Updating`,async()=>n.patch(`/accounts/${u}/magic/advanced_tcp_protection/configs/tcp_protection_status`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Updated`})}},Nt={command:`status`,describe:`Advanced Tcp Protection operations`,builder:e=>e.command(At).command(Mt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Pt={command:`protection`,describe:`Operations for advanced-tcp-protection.configs.tcp.protection`,builder:e=>e.command(Nt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ft={command:`tcp`,describe:`Operations for advanced-tcp-protection.configs.tcp`,builder:e=>e.command(Ot).command(Pt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},It={command:`configs`,describe:`Operations for advanced-tcp-protection.configs`,builder:e=>e.command(q).command(me).command(Je).command(Ft).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Lt={command:`advanced-tcp-protection`,describe:`Operations for advanced-tcp-protection`,builder:e=>e.command(It).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Rt(e){return e.option(`hostnames`,{type:`string`,array:!0,description:`FQDNs to associate with traffic decisions.`}).option(`name`,{type:`string`,description:`Display name for the app.`}).option(`type`,{type:`string`,description:`Category of the app.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const zt={command:`create`,describe:`Creates a new App for an account`,builder:Rt,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit apps create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/apps`,pathParams:{},bodyKind:`json`,body:{hostnames:t.hostnames,name:t.name,type:t.type,body:t.body}});return}let f=await r(t),p=t.local?d:await e(f);if(t.accountId=p,t.body){let e=o(t.body);s(await l(`Creating`,async()=>f.post(`/accounts/${p}/magic/apps`,{body:e})),{successLabel:`Created`});return}t.name===void 0&&(t.name=await n(`name`,`Display name for the app.`)),t.type===void 0&&(t.type=await n(`type`,`Category of the app.`));let m={};t.hostnames!==void 0&&a(m,[`hostnames`],t.hostnames),t.name!==void 0&&a(m,[`name`],u(t.name,`name`,`text`)),t.type!==void 0&&a(m,[`type`],u(t.type,`type`,`text`)),s(await l(`Creating`,async()=>f.post(`/accounts/${p}/magic/apps`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function Bt(e){return e.positional(`accountAppId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Vt={command:`delete <accountAppId>`,describe:`Deletes specific Account App.`,builder:Bt,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit apps delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/apps/${n.accountAppId??`<accountAppId>`}`,pathParams:{accountAppId:String(n.accountAppId??``)},bodyKind:`none`});return}let a=await r(n),o=n.local?d:await e(a);if(n.accountId=o,!await t({force:!!n.force})){process.stderr.write(`Aborted.
|
|
17
|
-
`);return}s(await l(`Deleting`,async()=>a.magicTransit.apps.delete(o,n.accountAppId)),{successLabel:`Deleted`})}};function Ht(e){return e.positional(`accountAppId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`hostnames`,{type:`string`,array:!0,description:`FQDNs to associate with traffic decisions.`}).option(`name`,{type:`string`,description:`Display name for the app.`}).option(`type`,{type:`string`,description:`Category of the app.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ut={command:`edit <accountAppId>`,describe:`Updates an Account App`,builder:Ht,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit apps edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/apps/${t.accountAppId??`<accountAppId>`}`,pathParams:{accountAppId:String(t.accountAppId??``)},bodyKind:`json`,body:{hostnames:t.hostnames,name:t.name,type:t.type,body:t.body}});return}let n=await r(t),f=t.local?d:await e(n);if(t.accountId=f,t.body){let e=o(t.body);s(await l(`Updating`,async()=>n.patch(`/accounts/${f}/magic/apps/${t.accountAppId}`,{body:e})),{successLabel:`Updated`});return}let p={};t.hostnames!==void 0&&a(p,[`hostnames`],t.hostnames),t.name!==void 0&&a(p,[`name`],u(t.name,`name`,`text`)),t.type!==void 0&&a(p,[`type`],u(t.type,`type`,`text`)),s(await l(`Updating`,async()=>n.patch(`/accounts/${f}/magic/apps/${t.accountAppId}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}};function Wt(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Gt={command:`list`,describe:`Lists Apps associated with an account.`,builder:Wt,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit apps list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/apps`,pathParams:{},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.magicTransit.apps.list(a)),{successLabel:`Loaded`})}};function Kt(e){return e.positional(`accountAppId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`hostnames`,{type:`string`,array:!0,description:`FQDNs to associate with traffic decisions.`}).option(`name`,{type:`string`,description:`Display name for the app.`}).option(`type`,{type:`string`,description:`Category of the app.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const qt={command:`update <accountAppId>`,describe:`Updates an Account App`,builder:Kt,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit apps update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/apps/${t.accountAppId??`<accountAppId>`}`,pathParams:{accountAppId:String(t.accountAppId??``)},bodyKind:`json`,body:{hostnames:t.hostnames,name:t.name,type:t.type,body:t.body}});return}let n=await r(t),f=t.local?d:await e(n);if(t.accountId=f,t.body){let e=o(t.body);s(await l(`Updating`,async()=>n.put(`/accounts/${f}/magic/apps/${t.accountAppId}`,{body:e})),{successLabel:`Updated`});return}let p={};t.hostnames!==void 0&&a(p,[`hostnames`],t.hostnames),t.name!==void 0&&a(p,[`name`],u(t.name,`name`,`text`)),t.type!==void 0&&a(p,[`type`],u(t.type,`type`,`text`)),s(await l(`Updating`,async()=>n.put(`/accounts/${f}/magic/apps/${t.accountAppId}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}},Jt={command:`apps`,describe:`Application-aware traffic policies for Magic WAN that steer traffic by app type`,builder:e=>e.command(zt).command(Vt).command(Ut).command(Gt).command(qt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Yt(e){return e.option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the request and response bodies will be presented using the new object format. Defaults to false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Xt={command:`bulk-update`,describe:"Updates multiple interconnects associated with an account. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes.",builder:Yt,handler:async t=>{let n={};if(t.xMagicNewHcTarget!==void 0&&(n[`x-magic-new-hc-target`]=String(t.xMagicNewHcTarget)),t.dryRun){c({command:`cf magic-transit cf-interconnects bulk-update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/cf_interconnects`,pathParams:{},bodyKind:`json`,body:{body:t.body}});return}let a=await r(t),u=t.local?d:await e(a);if(t.accountId=u,t.body){let e=o(t.body);s(await l(`Updating`,async()=>a.put(`/accounts/${u}/magic/cf_interconnects`,{body:e,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated`});return}s(await l(`Updating`,async()=>a.put(`/accounts/${u}/magic/cf_interconnects`,{headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated`})}};function Zt(e){return e.positional(`cfInterconnectId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the response body will be presented using the new object format. Defaults to false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Qt={command:`get <cfInterconnectId>`,describe:`Lists details for a specific interconnect.`,builder:Zt,handler:async t=>{let n={};if(t.xMagicNewHcTarget!==void 0&&(n[`x-magic-new-hc-target`]=String(t.xMagicNewHcTarget)),t.dryRun){c({command:`cf magic-transit cf-interconnects get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/cf_interconnects/${t.cfInterconnectId??`<cfInterconnectId>`}`,pathParams:{cfInterconnectId:String(t.cfInterconnectId??``)},bodyKind:`none`});return}let a=await r(t),o=t.local?d:await e(a);t.accountId=o,s(await l(`Loading`,async()=>a.get(`/accounts/${o}/magic/cf_interconnects/${t.cfInterconnectId}`,{headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Loaded`})}};function $t(e){return e.option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the response body will be presented using the new object format. Defaults to false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const en={command:`list`,describe:`Lists interconnects associated with an account.`,builder:$t,handler:async t=>{let n={};if(t.xMagicNewHcTarget!==void 0&&(n[`x-magic-new-hc-target`]=String(t.xMagicNewHcTarget)),t.dryRun){c({command:`cf magic-transit cf-interconnects list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/cf_interconnects`,pathParams:{},bodyKind:`none`});return}let a=await r(t),o=t.local?d:await e(a);t.accountId=o,s(await l(`Loading`,async()=>a.get(`/accounts/${o}/magic/cf_interconnects`,{headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Loaded`})}};function tn(e){return e.positional(`cfInterconnectId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the request and response bodies will be presented using the new object format. Defaults to false.`}).option(`automatic-return-routing`,{type:`boolean`,description:`True if automatic stateful return routing should be enabled for a tunnel, false otherwise.`,default:!1}).option(`description`,{type:`string`,description:`An optional description of the interconnect.`}).option(`gre-cloudflare-endpoint`,{type:`string`,description:`The IP address assigned to the Cloudflare side of the GRE tunnel created as part of the Interconnect.`}).option(`health-check-enabled`,{type:`boolean`,description:`Determines whether to run healthchecks for a tunnel.`,default:!0}).option(`health-check-rate`,{type:`string`,description:"How frequent the health check is run. The default value is `mid`.",choices:[`low`,`mid`,`high`],default:`mid`}).option(`health-check-target-saved`,{type:`string`,description:`The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used.`}).option(`health-check-type`,{type:`string`,description:"The type of healthcheck to run, reply or request. The default value is `reply`.",choices:[`reply`,`request`],default:`reply`}).option(`interface-address`,{type:`string`,description:`A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255.`}).option(`interface-address6`,{type:`string`,description:`A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127`}).option(`mtu`,{type:`number`,description:`The Maximum Transmission Unit (MTU) in bytes for the interconnect. The minimum value is 576.`,default:1476}).option(`name`,{type:`string`,description:`The name of the interconnect. The name cannot share a name with other tunnels.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const nn={command:`update <cfInterconnectId>`,describe:"Updates a specific interconnect associated with an account. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes.",builder:tn,handler:async t=>{let n={};if(t.xMagicNewHcTarget!==void 0&&(n[`x-magic-new-hc-target`]=String(t.xMagicNewHcTarget)),t.dryRun){c({command:`cf magic-transit cf-interconnects update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/cf_interconnects/${t.cfInterconnectId??`<cfInterconnectId>`}`,pathParams:{cfInterconnectId:String(t.cfInterconnectId??``)},bodyKind:`json`,body:{automaticReturnRouting:t.automaticReturnRouting,description:t.description,greCloudflareEndpoint:t.greCloudflareEndpoint,healthCheckEnabled:t.healthCheckEnabled,healthCheckRate:t.healthCheckRate,healthCheckTargetSaved:t.healthCheckTargetSaved,healthCheckType:t.healthCheckType,interfaceAddress:t.interfaceAddress,interfaceAddress6:t.interfaceAddress6,mtu:t.mtu,name:t.name,body:t.body}});return}let f=await r(t),p=t.local?d:await e(f);if(t.accountId=p,t.body){let e=o(t.body);s(await l(`Updating`,async()=>f.put(`/accounts/${p}/magic/cf_interconnects/${t.cfInterconnectId}`,{body:e,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated`});return}let m={};t.automaticReturnRouting!==void 0&&a(m,[`automatic_return_routing`],t.automaticReturnRouting),t.description!==void 0&&a(m,[`description`],u(t.description,`description`,`text`)),t.greCloudflareEndpoint!==void 0&&a(m,[`gre`,`cloudflare_endpoint`],u(t.greCloudflareEndpoint,`greCloudflareEndpoint`,`text`)),t.healthCheckEnabled!==void 0&&a(m,[`health_check`,`enabled`],t.healthCheckEnabled),t.healthCheckRate!==void 0&&a(m,[`health_check`,`rate`],u(t.healthCheckRate,`healthCheckRate`,`text`)),t.healthCheckTargetSaved!==void 0&&a(m,[`health_check`,`target`,`saved`],u(t.healthCheckTargetSaved,`healthCheckTargetSaved`,`text`)),t.healthCheckType!==void 0&&a(m,[`health_check`,`type`],u(t.healthCheckType,`healthCheckType`,`text`)),t.interfaceAddress!==void 0&&a(m,[`interface_address`],u(t.interfaceAddress,`interfaceAddress`,`text`)),t.interfaceAddress6!==void 0&&a(m,[`interface_address6`],u(t.interfaceAddress6,`interfaceAddress6`,`text`)),t.mtu!==void 0&&a(m,[`mtu`],t.mtu),t.name!==void 0&&a(m,[`name`],u(t.name,`name`,`text`)),s(await l(`Updating`,async()=>f.put(`/accounts/${p}/magic/cf_interconnects/${t.cfInterconnectId}`,{body:Object.keys(m).length>0?m:void 0,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated`})}},rn={command:`cf-interconnects`,describe:`Cloudflare Network Interconnect (CNI) links for direct physical or virtual peering`,builder:e=>e.command(Xt).command(Qt).command(en).command(nn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function an(e){return e.option(`device-id`,{type:`string`,description:`The device.id field`}).option(`device-provision-license`,{type:`boolean`,description:`When true, create and provision a new licence key for the connector.`}).option(`device-serial-number`,{type:`string`,description:`The device.serial_number field`}).option(`activated`,{type:`boolean`,description:`The activated field`}).option(`interrupt-window-days-of-week`,{type:`string`,array:!0,description:`Allowed days of the week for upgrades. Default is all days.`}).option(`interrupt-window-duration-hours`,{type:`number`,description:`The interrupt_window_duration_hours field`}).option(`interrupt-window-embargo-dates`,{type:`string`,array:!0,description:`List of dates (YYYY-MM-DD) when upgrades are blocked.`}).option(`interrupt-window-hour-of-day`,{type:`number`,description:`The interrupt_window_hour_of_day field`}).option(`notes`,{type:`string`,description:`The notes field`}).option(`timezone`,{type:`string`,description:`The timezone field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const on={command:`create`,describe:`Creates a new Magic WAN Connector for establishing secure network connectivity. Connectors enable site-to-site VPN and SDWAN functionality.`,builder:an,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit connectors create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/connectors`,pathParams:{},bodyKind:`json`,body:{deviceId:t.deviceId,deviceProvisionLicense:t.deviceProvisionLicense,deviceSerialNumber:t.deviceSerialNumber,activated:t.activated,interruptWindowDaysOfWeek:t.interruptWindowDaysOfWeek,interruptWindowDurationHours:t.interruptWindowDurationHours,interruptWindowEmbargoDates:t.interruptWindowEmbargoDates,interruptWindowHourOfDay:t.interruptWindowHourOfDay,notes:t.notes,timezone:t.timezone,body:t.body}});return}let n=await r(t),f=t.local?d:await e(n);if(t.accountId=f,t.body){let e=o(t.body);s(await l(`Creating`,async()=>n.post(`/accounts/${f}/magic/connectors`,{body:e})),{successLabel:`Created`});return}let p={};t.deviceId!==void 0&&a(p,[`device`,`id`],u(t.deviceId,`deviceId`,`text`)),t.deviceProvisionLicense!==void 0&&a(p,[`device`,`provision_license`],t.deviceProvisionLicense),t.deviceSerialNumber!==void 0&&a(p,[`device`,`serial_number`],u(t.deviceSerialNumber,`deviceSerialNumber`,`text`)),t.activated!==void 0&&a(p,[`activated`],t.activated),t.interruptWindowDaysOfWeek!==void 0&&a(p,[`interrupt_window_days_of_week`],t.interruptWindowDaysOfWeek),t.interruptWindowDurationHours!==void 0&&a(p,[`interrupt_window_duration_hours`],t.interruptWindowDurationHours),t.interruptWindowEmbargoDates!==void 0&&a(p,[`interrupt_window_embargo_dates`],t.interruptWindowEmbargoDates),t.interruptWindowHourOfDay!==void 0&&a(p,[`interrupt_window_hour_of_day`],t.interruptWindowHourOfDay),t.notes!==void 0&&a(p,[`notes`],u(t.notes,`notes`,`text`)),t.timezone!==void 0&&a(p,[`timezone`],u(t.timezone,`timezone`,`text`)),s(await l(`Creating`,async()=>n.post(`/accounts/${f}/magic/connectors`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`})}};function sn(e){return e.positional(`connectorId`,{type:`string`,description:`Connector ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const cn={command:`delete <connectorId>`,describe:`Removes a Magic WAN Connector. The connector will be deregistered and network connectivity through it will be terminated.`,builder:sn,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit connectors delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/connectors/${n.connectorId??`<connectorId>`}`,pathParams:{connectorId:String(n.connectorId??``)},bodyKind:`none`});return}let a=await r(n),o=n.local?d:await e(a);if(n.accountId=o,!await t({force:!!n.force})){process.stderr.write(`Aborted.
|
|
18
|
-
`);return}s(await l(`Deleting`,async()=>a.magicTransit.connectors.delete(o,n.connectorId)),{successLabel:`Deleted`})}};function ln(e){return e.positional(`connectorId`,{type:`string`,description:`Connector ID`,demandOption:!0}).option(`activated`,{type:`boolean`,description:`The activated field`}).option(`interrupt-window-days-of-week`,{type:`string`,array:!0,description:`Allowed days of the week for upgrades. Default is all days.`}).option(`interrupt-window-duration-hours`,{type:`number`,description:`The interrupt_window_duration_hours field`}).option(`interrupt-window-embargo-dates`,{type:`string`,array:!0,description:`List of dates (YYYY-MM-DD) when upgrades are blocked.`}).option(`interrupt-window-hour-of-day`,{type:`number`,description:`The interrupt_window_hour_of_day field`}).option(`notes`,{type:`string`,description:`The notes field`}).option(`timezone`,{type:`string`,description:`The timezone field`}).option(`provision-license`,{type:`boolean`,description:`When true, regenerate license key for the connector.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const un={command:`edit <connectorId>`,describe:`Updates the configuration of an existing Magic WAN Connector, such as network settings or policies.`,builder:ln,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit connectors edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/connectors/${t.connectorId??`<connectorId>`}`,pathParams:{connectorId:String(t.connectorId??``)},bodyKind:`json`,body:{activated:t.activated,interruptWindowDaysOfWeek:t.interruptWindowDaysOfWeek,interruptWindowDurationHours:t.interruptWindowDurationHours,interruptWindowEmbargoDates:t.interruptWindowEmbargoDates,interruptWindowHourOfDay:t.interruptWindowHourOfDay,notes:t.notes,timezone:t.timezone,provisionLicense:t.provisionLicense,body:t.body}});return}let n=await r(t),f=t.local?d:await e(n);if(t.accountId=f,t.body){let e=o(t.body);s(await l(`Updating`,async()=>n.patch(`/accounts/${f}/magic/connectors/${t.connectorId}`,{body:e})),{successLabel:`Updated`});return}let p={};t.activated!==void 0&&a(p,[`activated`],t.activated),t.interruptWindowDaysOfWeek!==void 0&&a(p,[`interrupt_window_days_of_week`],t.interruptWindowDaysOfWeek),t.interruptWindowDurationHours!==void 0&&a(p,[`interrupt_window_duration_hours`],t.interruptWindowDurationHours),t.interruptWindowEmbargoDates!==void 0&&a(p,[`interrupt_window_embargo_dates`],t.interruptWindowEmbargoDates),t.interruptWindowHourOfDay!==void 0&&a(p,[`interrupt_window_hour_of_day`],t.interruptWindowHourOfDay),t.notes!==void 0&&a(p,[`notes`],u(t.notes,`notes`,`text`)),t.timezone!==void 0&&a(p,[`timezone`],u(t.timezone,`timezone`,`text`)),t.provisionLicense!==void 0&&a(p,[`provision_license`],t.provisionLicense),s(await l(`Updating`,async()=>n.patch(`/accounts/${f}/magic/connectors/${t.connectorId}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}};function dn(e){return e.positional(`eventN`,{type:`string`,description:`Event n`,demandOption:!0}).option(`connector-id`,{type:`string`,description:`Connector ID`,demandOption:!0}).option(`event-t`,{type:`string`,description:`Event t`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const fn={command:`get <eventN>`,describe:`Retrieves a specific telemetry event from a Magic WAN Connector for troubleshooting and monitoring.`,builder:dn,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit connectors events get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/connectors/${t.connectorId??`<connectorId>`}/telemetry/events/${t.eventT??`<eventT>`}.${t.eventN??`<eventN>`}`,pathParams:{connectorId:String(t.connectorId??``),eventT:String(t.eventT??``),eventN:String(t.eventN??``)},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.magicTransit.connectors.events.get(a,t.connectorId,t.eventT,t.eventN)),{successLabel:`Loaded`})}};function pn(e){return e.option(`connector-id`,{type:`string`,description:`Connector ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const mn={command:`list`,describe:`Retrieves the most recent telemetry events from a Magic WAN Connector.`,builder:pn,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit connectors events latest list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/connectors/${t.connectorId??`<connectorId>`}/telemetry/events/latest`,pathParams:{connectorId:String(t.connectorId??``)},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.magicTransit.connectors.events.latest.list(a,t.connectorId)),{successLabel:`Loaded`})}},hn={command:`latest`,describe:`Magic WAN Connector appliances — provisioning, telemetry events, and configuration snapshots`,builder:e=>e.command(mn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function gn(e){return e.option(`connector-id`,{type:`string`,description:`Connector ID`,demandOption:!0}).option(`from`,{type:`number`,description:`From`,demandOption:!0}).option(`to`,{type:`number`,description:`To`,demandOption:!0}).option(`limit`,{type:`number`,description:`Limit`}).option(`cursor`,{type:`string`,description:`Cursor`}).option(`k`,{type:`string`,description:`Filter by event kind`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _n={command:`list`,describe:`Lists telemetry events from a Magic WAN Connector, showing connection events and status changes.`,builder:gn,handler:async t=>{let n={from:t.from,to:t.to,limit:t.limit,cursor:t.cursor,k:t.k};if(t.dryRun){c({command:`cf magic-transit connectors events list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/connectors/${t.connectorId??`<connectorId>`}/telemetry/events`,pathParams:{connectorId:String(t.connectorId??``)},query:n,bodyKind:`none`});return}let a=await r(t),o=t.local?d:await e(a);t.accountId=o,s(await l(`Loading`,async()=>a.magicTransit.connectors.events.list(o,t.connectorId,n)),{successLabel:`Loaded`})}},vn={command:`events`,describe:`Magic WAN Connector appliances — provisioning, telemetry events, and configuration snapshots`,builder:e=>e.command(fn).command(_n).command(hn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function yn(e){return e.positional(`connectorId`,{type:`string`,description:`Connector ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const bn={command:`get <connectorId>`,describe:`Retrieves detailed configuration for a specific Magic WAN Connector, including its status and network settings.`,builder:yn,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit connectors get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/connectors/${t.connectorId??`<connectorId>`}`,pathParams:{connectorId:String(t.connectorId??``)},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.magicTransit.connectors.get(a,t.connectorId)),{successLabel:`Loaded`})}};function xn(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Sn={command:`list`,describe:`Lists all Magic WAN Connectors configured for the account with their status and connection information.`,builder:xn,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit connectors list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/connectors`,pathParams:{},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.magicTransit.connectors.list(a)),{successLabel:`Loaded`})}};function Cn(e){return e.positional(`snapshotT`,{type:`string`,description:`Snapshot t`,demandOption:!0}).option(`connector-id`,{type:`string`,description:`Connector ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $={command:`get <snapshotT>`,describe:`Gets a specific telemetry snapshot from a Magic WAN Connector, showing point-in-time metrics.`,builder:Cn,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit connectors snapshots get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/connectors/${t.connectorId??`<connectorId>`}/telemetry/snapshots/${t.snapshotT??`<snapshotT>`}`,pathParams:{connectorId:String(t.connectorId??``),snapshotT:String(t.snapshotT??``)},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.magicTransit.connectors.snapshots.get(a,t.connectorId,t.snapshotT)),{successLabel:`Loaded`})}};function wn(e){return e.option(`connector-id`,{type:`string`,description:`Connector ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Tn={command:`list`,describe:`Retrieves the most recent telemetry snapshots from a Magic WAN Connector.`,builder:wn,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit connectors snapshots latest list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/connectors/${t.connectorId??`<connectorId>`}/telemetry/snapshots/latest`,pathParams:{connectorId:String(t.connectorId??``)},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.magicTransit.connectors.snapshots.latest.list(a,t.connectorId)),{successLabel:`Loaded`})}},En={command:`latest`,describe:`Magic WAN Connector appliances — provisioning, telemetry events, and configuration snapshots`,builder:e=>e.command(Tn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Dn(e){return e.option(`connector-id`,{type:`string`,description:`Connector ID`,demandOption:!0}).option(`from`,{type:`number`,description:`From`,demandOption:!0}).option(`to`,{type:`number`,description:`To`,demandOption:!0}).option(`limit`,{type:`number`,description:`Limit`}).option(`cursor`,{type:`string`,description:`Cursor`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const On={command:`list`,describe:`Lists telemetry snapshots from a Magic WAN Connector, providing historical performance data.`,builder:Dn,handler:async t=>{let n={from:t.from,to:t.to,limit:t.limit,cursor:t.cursor};if(t.dryRun){c({command:`cf magic-transit connectors snapshots list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/connectors/${t.connectorId??`<connectorId>`}/telemetry/snapshots`,pathParams:{connectorId:String(t.connectorId??``)},query:n,bodyKind:`none`});return}let a=await r(t),o=t.local?d:await e(a);t.accountId=o,s(await l(`Loading`,async()=>a.magicTransit.connectors.snapshots.list(o,t.connectorId,n)),{successLabel:`Loaded`})}},kn={command:`snapshots`,describe:`Magic WAN Connector appliances — provisioning, telemetry events, and configuration snapshots`,builder:e=>e.command($).command(On).command(En).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function An(e){return e.positional(`connectorId`,{type:`string`,description:`Connector ID`,demandOption:!0}).option(`activated`,{type:`boolean`,description:`The activated field`}).option(`interrupt-window-days-of-week`,{type:`string`,array:!0,description:`Allowed days of the week for upgrades. Default is all days.`}).option(`interrupt-window-duration-hours`,{type:`number`,description:`The interrupt_window_duration_hours field`}).option(`interrupt-window-embargo-dates`,{type:`string`,array:!0,description:`List of dates (YYYY-MM-DD) when upgrades are blocked.`}).option(`interrupt-window-hour-of-day`,{type:`number`,description:`The interrupt_window_hour_of_day field`}).option(`notes`,{type:`string`,description:`The notes field`}).option(`timezone`,{type:`string`,description:`The timezone field`}).option(`provision-license`,{type:`boolean`,description:`When true, regenerate license key for the connector.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const jn={command:`update <connectorId>`,describe:`Replaces the configuration of an existing Magic WAN Connector with new settings.`,builder:An,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit connectors update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/connectors/${t.connectorId??`<connectorId>`}`,pathParams:{connectorId:String(t.connectorId??``)},bodyKind:`json`,body:{activated:t.activated,interruptWindowDaysOfWeek:t.interruptWindowDaysOfWeek,interruptWindowDurationHours:t.interruptWindowDurationHours,interruptWindowEmbargoDates:t.interruptWindowEmbargoDates,interruptWindowHourOfDay:t.interruptWindowHourOfDay,notes:t.notes,timezone:t.timezone,provisionLicense:t.provisionLicense,body:t.body}});return}let n=await r(t),f=t.local?d:await e(n);if(t.accountId=f,t.body){let e=o(t.body);s(await l(`Updating`,async()=>n.put(`/accounts/${f}/magic/connectors/${t.connectorId}`,{body:e})),{successLabel:`Updated`});return}let p={};t.activated!==void 0&&a(p,[`activated`],t.activated),t.interruptWindowDaysOfWeek!==void 0&&a(p,[`interrupt_window_days_of_week`],t.interruptWindowDaysOfWeek),t.interruptWindowDurationHours!==void 0&&a(p,[`interrupt_window_duration_hours`],t.interruptWindowDurationHours),t.interruptWindowEmbargoDates!==void 0&&a(p,[`interrupt_window_embargo_dates`],t.interruptWindowEmbargoDates),t.interruptWindowHourOfDay!==void 0&&a(p,[`interrupt_window_hour_of_day`],t.interruptWindowHourOfDay),t.notes!==void 0&&a(p,[`notes`],u(t.notes,`notes`,`text`)),t.timezone!==void 0&&a(p,[`timezone`],u(t.timezone,`timezone`,`text`)),t.provisionLicense!==void 0&&a(p,[`provision_license`],t.provisionLicense),s(await l(`Updating`,async()=>n.put(`/accounts/${f}/magic/connectors/${t.connectorId}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}},Mn={command:`connectors`,describe:`Magic WAN Connector appliances — provisioning, telemetry events, and configuration snapshots`,builder:e=>e.command(on).command(cn).command(un).command(bn).command(Sn).command(jn).command(vn).command(kn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Nn(e){return e.option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the request and response bodies will be presented using the new object format. Defaults to false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Pn={command:`bulk-update`,describe:"Updates multiple GRE tunnels. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes.",builder:Nn,handler:async t=>{let n={};if(t.xMagicNewHcTarget!==void 0&&(n[`x-magic-new-hc-target`]=String(t.xMagicNewHcTarget)),t.dryRun){c({command:`cf magic-transit gre-tunnels bulk-update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/gre_tunnels`,pathParams:{},bodyKind:`json`,body:{body:t.body}});return}let a=await r(t),u=t.local?d:await e(a);if(t.accountId=u,t.body){let e=o(t.body);s(await l(`Updating`,async()=>a.put(`/accounts/${u}/magic/gre_tunnels`,{body:e,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated`});return}s(await l(`Updating`,async()=>a.put(`/accounts/${u}/magic/gre_tunnels`,{headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated`})}};function Fn(e){return e.option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the request and response bodies will be presented using the new object format. Defaults to false.`}).option(`automatic-return-routing`,{type:`boolean`,description:`True if automatic stateful return routing should be enabled for a tunnel, false otherwise.`,default:!1}).option(`bgp-customer-asn`,{type:`number`,description:`ASN used on the customer end of the BGP session`}).option(`bgp-extra-prefixes`,{type:`string`,array:!0,description:`Prefixes in this list will be advertised to the customer device, in addition to the routes in the Magic routing table.`}).option(`bgp-md5-key`,{type:`string`,description:`MD5 key to use for session authentication.
|
|
19
|
-
|
|
20
|
-
Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the
|
|
21
|
-
key is not treated as a secret value. This is *only* supported for preventing
|
|
22
|
-
misconfiguration, not for defending against malicious attacks.
|
|
23
|
-
|
|
24
|
-
The MD5 key, if set, must be of non-zero length and consist only of the following types of
|
|
25
|
-
character:
|
|
26
|
-
|
|
27
|
-
* ASCII alphanumerics: \`[a-zA-Z0-9]\`
|
|
28
|
-
* Special characters in the set \`'!@#$%^&*()+[]{}<>/.,;:_-~\`= \\|\`
|
|
29
|
-
|
|
30
|
-
In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A),
|
|
31
|
-
quotation mark (\`"\`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed
|
|
32
|
-
(0x0C), and the question mark (\`?\`). Requests specifying an MD5 key with one or more of
|
|
33
|
-
these disallowed characters will be rejected.`}).option(`cloudflare-gre-endpoint`,{type:`string`,description:`The IP address assigned to the Cloudflare side of the GRE tunnel.`}).option(`customer-gre-endpoint`,{type:`string`,description:`The IP address assigned to the customer side of the GRE tunnel.`}).option(`description`,{type:`string`,description:`An optional description of the GRE tunnel.`}).option(`health-check-enabled`,{type:`boolean`,description:`Determines whether to run healthchecks for a tunnel.`,default:!0}).option(`health-check-rate`,{type:`string`,description:"How frequent the health check is run. The default value is `mid`.",choices:[`low`,`mid`,`high`],default:`mid`}).option(`health-check-target-saved`,{type:`string`,description:`The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used.`}).option(`health-check-type`,{type:`string`,description:"The type of healthcheck to run, reply or request. The default value is `reply`.",choices:[`reply`,`request`],default:`reply`}).option(`health-check-direction`,{type:`string`,description:`The direction of the flow of the healthcheck. Either unidirectional, where the probe comes to you via the tunnel and the result comes back to Cloudflare via the open Internet, or bidirectional where both the probe and result come and go via the tunnel.`,choices:[`unidirectional`,`bidirectional`],default:`unidirectional`}).option(`interface-address`,{type:`string`,description:`A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255.`}).option(`interface-address6`,{type:`string`,description:`A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127`}).option(`mtu`,{type:`number`,description:`Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. The minimum value is 576.`,default:1476}).option(`name`,{type:`string`,description:`The name of the tunnel. The name cannot contain spaces or special characters, must be 15 characters or less, and cannot share a name with another GRE tunnel.`}).option(`ttl`,{type:`number`,description:`Time To Live (TTL) in number of hops of the GRE tunnel.`,default:64}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`bgp-customer-asn`,`bgp-extra-prefixes`,`bgp-md5key`].some(t=>e[t]!==void 0)){let t=[`bgp-customer-asn`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --bgp-* flag is set`)}return!0})}const In={command:`create`,describe:"Creates a new GRE tunnel. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes.",builder:Fn,handler:async t=>{let f={};if(t.xMagicNewHcTarget!==void 0&&(f[`x-magic-new-hc-target`]=String(t.xMagicNewHcTarget)),t.dryRun){c({command:`cf magic-transit gre-tunnels create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/gre_tunnels`,pathParams:{},bodyKind:`json`,body:{automaticReturnRouting:t.automaticReturnRouting,bgpCustomerAsn:t.bgpCustomerAsn,bgpExtraPrefixes:t.bgpExtraPrefixes,bgpMd5Key:t.bgpMd5Key,cloudflareGreEndpoint:t.cloudflareGreEndpoint,customerGreEndpoint:t.customerGreEndpoint,description:t.description,healthCheckEnabled:t.healthCheckEnabled,healthCheckRate:t.healthCheckRate,healthCheckTargetSaved:t.healthCheckTargetSaved,healthCheckType:t.healthCheckType,healthCheckDirection:t.healthCheckDirection,interfaceAddress:t.interfaceAddress,interfaceAddress6:t.interfaceAddress6,mtu:t.mtu,name:t.name,ttl:t.ttl,body:t.body}});return}let p=await r(t),m=t.local?d:await e(p);if(t.accountId=m,t.body){let e=o(t.body);s(await l(`Creating`,async()=>p.post(`/accounts/${m}/magic/gre_tunnels`,{body:e,headers:Object.keys(f).length>0?f:void 0})),{successLabel:`Created`});return}t.cloudflareGreEndpoint===void 0&&(t.cloudflareGreEndpoint=await n(`cloudflare-gre-endpoint`,`The IP address assigned to the Cloudflare side of the GRE tunnel.`)),t.customerGreEndpoint===void 0&&(t.customerGreEndpoint=await n(`customer-gre-endpoint`,`The IP address assigned to the customer side of the GRE tunnel.`)),t.interfaceAddress===void 0&&(t.interfaceAddress=await n(`interface-address`,`A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255.`)),t.name===void 0&&(t.name=await n(`name`,`The name of the tunnel. The name cannot contain spaces or special characters, must be 15 characters or less, and cannot share a name with another GRE tunnel.`));let h={};t.automaticReturnRouting!==void 0&&a(h,[`automatic_return_routing`],t.automaticReturnRouting),t.bgpCustomerAsn!==void 0&&a(h,[`bgp`,`customer_asn`],t.bgpCustomerAsn),t.bgpExtraPrefixes!==void 0&&a(h,[`bgp`,`extra_prefixes`],t.bgpExtraPrefixes),t.bgpMd5Key!==void 0&&a(h,[`bgp`,`md5_key`],u(t.bgpMd5Key,`bgpMd5Key`,`text`)),t.cloudflareGreEndpoint!==void 0&&a(h,[`cloudflare_gre_endpoint`],u(t.cloudflareGreEndpoint,`cloudflareGreEndpoint`,`text`)),t.customerGreEndpoint!==void 0&&a(h,[`customer_gre_endpoint`],u(t.customerGreEndpoint,`customerGreEndpoint`,`text`)),t.description!==void 0&&a(h,[`description`],u(t.description,`description`,`text`)),t.healthCheckEnabled!==void 0&&a(h,[`health_check`,`enabled`],t.healthCheckEnabled),t.healthCheckRate!==void 0&&a(h,[`health_check`,`rate`],u(t.healthCheckRate,`healthCheckRate`,`text`)),t.healthCheckTargetSaved!==void 0&&a(h,[`health_check`,`target`,`saved`],u(t.healthCheckTargetSaved,`healthCheckTargetSaved`,`text`)),t.healthCheckType!==void 0&&a(h,[`health_check`,`type`],u(t.healthCheckType,`healthCheckType`,`text`)),t.healthCheckDirection!==void 0&&a(h,[`health_check`,`direction`],u(t.healthCheckDirection,`healthCheckDirection`,`text`)),t.interfaceAddress!==void 0&&a(h,[`interface_address`],u(t.interfaceAddress,`interfaceAddress`,`text`)),t.interfaceAddress6!==void 0&&a(h,[`interface_address6`],u(t.interfaceAddress6,`interfaceAddress6`,`text`)),t.mtu!==void 0&&a(h,[`mtu`],t.mtu),t.name!==void 0&&a(h,[`name`],u(t.name,`name`,`text`)),t.ttl!==void 0&&a(h,[`ttl`],t.ttl),s(await l(`Creating`,async()=>p.post(`/accounts/${m}/magic/gre_tunnels`,{body:Object.keys(h).length>0?h:void 0,headers:Object.keys(f).length>0?f:void 0})),{successLabel:`Created`})}};function Ln(e){return e.positional(`greTunnelId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the response body will be presented using the new object format. Defaults to false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Rn={command:`delete <greTunnelId>`,describe:"Disables and removes a specific static GRE tunnel. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes.",builder:Ln,handler:async n=>{let a={};if(n.xMagicNewHcTarget!==void 0&&(a[`x-magic-new-hc-target`]=String(n.xMagicNewHcTarget)),n.dryRun){c({command:`cf magic-transit gre-tunnels delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/gre_tunnels/${n.greTunnelId??`<greTunnelId>`}`,pathParams:{greTunnelId:String(n.greTunnelId??``)},bodyKind:`json`,body:{body:n.body}});return}let u=await r(n),f=n.local?d:await e(u);if(n.accountId=f,!await t({force:!!n.force})){process.stderr.write(`Aborted.
|
|
34
|
-
`);return}if(n.body){let e=o(n.body);s(await l(`Deleting`,async()=>u.delete(`/accounts/${f}/magic/gre_tunnels/${n.greTunnelId}`,{body:e,headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Deleted`});return}s(await l(`Deleting`,async()=>u.delete(`/accounts/${f}/magic/gre_tunnels/${n.greTunnelId}`,{headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Deleted`})}};function zn(e){return e.positional(`greTunnelId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the response body will be presented using the new object format. Defaults to false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Bn={command:`get <greTunnelId>`,describe:`Lists informtion for a specific GRE tunnel.`,builder:zn,handler:async t=>{let n={};if(t.xMagicNewHcTarget!==void 0&&(n[`x-magic-new-hc-target`]=String(t.xMagicNewHcTarget)),t.dryRun){c({command:`cf magic-transit gre-tunnels get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/gre_tunnels/${t.greTunnelId??`<greTunnelId>`}`,pathParams:{greTunnelId:String(t.greTunnelId??``)},bodyKind:`none`});return}let a=await r(t),o=t.local?d:await e(a);t.accountId=o,s(await l(`Loading`,async()=>a.get(`/accounts/${o}/magic/gre_tunnels/${t.greTunnelId}`,{headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Loaded`})}};function Vn(e){return e.option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the response body will be presented using the new object format. Defaults to false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Hn={command:`list`,describe:`Lists GRE tunnels associated with an account.`,builder:Vn,handler:async t=>{let n={};if(t.xMagicNewHcTarget!==void 0&&(n[`x-magic-new-hc-target`]=String(t.xMagicNewHcTarget)),t.dryRun){c({command:`cf magic-transit gre-tunnels list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/gre_tunnels`,pathParams:{},bodyKind:`none`});return}let a=await r(t),o=t.local?d:await e(a);t.accountId=o,s(await l(`Loading`,async()=>a.get(`/accounts/${o}/magic/gre_tunnels`,{headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Loaded`})}};function Un(e){return e.positional(`greTunnelId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the request and response bodies will be presented using the new object format. Defaults to false.`}).option(`automatic-return-routing`,{type:`boolean`,description:`True if automatic stateful return routing should be enabled for a tunnel, false otherwise.`,default:!1}).option(`cloudflare-gre-endpoint`,{type:`string`,description:`The IP address assigned to the Cloudflare side of the GRE tunnel.`}).option(`customer-gre-endpoint`,{type:`string`,description:`The IP address assigned to the customer side of the GRE tunnel.`}).option(`description`,{type:`string`,description:`An optional description of the GRE tunnel.`}).option(`health-check-enabled`,{type:`boolean`,description:`Determines whether to run healthchecks for a tunnel.`,default:!0}).option(`health-check-rate`,{type:`string`,description:"How frequent the health check is run. The default value is `mid`.",choices:[`low`,`mid`,`high`],default:`mid`}).option(`health-check-target-saved`,{type:`string`,description:`The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used.`}).option(`health-check-type`,{type:`string`,description:"The type of healthcheck to run, reply or request. The default value is `reply`.",choices:[`reply`,`request`],default:`reply`}).option(`health-check-direction`,{type:`string`,description:`The direction of the flow of the healthcheck. Either unidirectional, where the probe comes to you via the tunnel and the result comes back to Cloudflare via the open Internet, or bidirectional where both the probe and result come and go via the tunnel.`,choices:[`unidirectional`,`bidirectional`],default:`unidirectional`}).option(`interface-address`,{type:`string`,description:`A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255.`}).option(`interface-address6`,{type:`string`,description:`A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127`}).option(`mtu`,{type:`number`,description:`Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. The minimum value is 576.`,default:1476}).option(`name`,{type:`string`,description:`The name of the tunnel. The name cannot contain spaces or special characters, must be 15 characters or less, and cannot share a name with another GRE tunnel.`}).option(`ttl`,{type:`number`,description:`Time To Live (TTL) in number of hops of the GRE tunnel.`,default:64}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Wn={command:`update <greTunnelId>`,describe:"Updates a specific GRE tunnel. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes.",builder:Un,handler:async t=>{let f={};if(t.xMagicNewHcTarget!==void 0&&(f[`x-magic-new-hc-target`]=String(t.xMagicNewHcTarget)),t.dryRun){c({command:`cf magic-transit gre-tunnels update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/gre_tunnels/${t.greTunnelId??`<greTunnelId>`}`,pathParams:{greTunnelId:String(t.greTunnelId??``)},bodyKind:`json`,body:{automaticReturnRouting:t.automaticReturnRouting,cloudflareGreEndpoint:t.cloudflareGreEndpoint,customerGreEndpoint:t.customerGreEndpoint,description:t.description,healthCheckEnabled:t.healthCheckEnabled,healthCheckRate:t.healthCheckRate,healthCheckTargetSaved:t.healthCheckTargetSaved,healthCheckType:t.healthCheckType,healthCheckDirection:t.healthCheckDirection,interfaceAddress:t.interfaceAddress,interfaceAddress6:t.interfaceAddress6,mtu:t.mtu,name:t.name,ttl:t.ttl,body:t.body}});return}let p=await r(t),m=t.local?d:await e(p);if(t.accountId=m,t.body){let e=o(t.body);s(await l(`Updating`,async()=>p.put(`/accounts/${m}/magic/gre_tunnels/${t.greTunnelId}`,{body:e,headers:Object.keys(f).length>0?f:void 0})),{successLabel:`Updated`});return}t.cloudflareGreEndpoint===void 0&&(t.cloudflareGreEndpoint=await n(`cloudflare-gre-endpoint`,`The IP address assigned to the Cloudflare side of the GRE tunnel.`)),t.customerGreEndpoint===void 0&&(t.customerGreEndpoint=await n(`customer-gre-endpoint`,`The IP address assigned to the customer side of the GRE tunnel.`)),t.interfaceAddress===void 0&&(t.interfaceAddress=await n(`interface-address`,`A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255.`)),t.name===void 0&&(t.name=await n(`name`,`The name of the tunnel. The name cannot contain spaces or special characters, must be 15 characters or less, and cannot share a name with another GRE tunnel.`));let h={};t.automaticReturnRouting!==void 0&&a(h,[`automatic_return_routing`],t.automaticReturnRouting),t.cloudflareGreEndpoint!==void 0&&a(h,[`cloudflare_gre_endpoint`],u(t.cloudflareGreEndpoint,`cloudflareGreEndpoint`,`text`)),t.customerGreEndpoint!==void 0&&a(h,[`customer_gre_endpoint`],u(t.customerGreEndpoint,`customerGreEndpoint`,`text`)),t.description!==void 0&&a(h,[`description`],u(t.description,`description`,`text`)),t.healthCheckEnabled!==void 0&&a(h,[`health_check`,`enabled`],t.healthCheckEnabled),t.healthCheckRate!==void 0&&a(h,[`health_check`,`rate`],u(t.healthCheckRate,`healthCheckRate`,`text`)),t.healthCheckTargetSaved!==void 0&&a(h,[`health_check`,`target`,`saved`],u(t.healthCheckTargetSaved,`healthCheckTargetSaved`,`text`)),t.healthCheckType!==void 0&&a(h,[`health_check`,`type`],u(t.healthCheckType,`healthCheckType`,`text`)),t.healthCheckDirection!==void 0&&a(h,[`health_check`,`direction`],u(t.healthCheckDirection,`healthCheckDirection`,`text`)),t.interfaceAddress!==void 0&&a(h,[`interface_address`],u(t.interfaceAddress,`interfaceAddress`,`text`)),t.interfaceAddress6!==void 0&&a(h,[`interface_address6`],u(t.interfaceAddress6,`interfaceAddress6`,`text`)),t.mtu!==void 0&&a(h,[`mtu`],t.mtu),t.name!==void 0&&a(h,[`name`],u(t.name,`name`,`text`)),t.ttl!==void 0&&a(h,[`ttl`],t.ttl),s(await l(`Updating`,async()=>p.put(`/accounts/${m}/magic/gre_tunnels/${t.greTunnelId}`,{body:Object.keys(h).length>0?h:void 0,headers:Object.keys(f).length>0?f:void 0})),{successLabel:`Updated`})}},Gn={command:`gre-tunnels`,describe:`GRE tunnel endpoints that connect your network to Cloudflare for Magic Transit`,builder:e=>e.command(Pn).command(In).command(Rn).command(Bn).command(Hn).command(Wn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Kn(e){return e.option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the request and response bodies will be presented using the new object format. Defaults to false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const qn={command:`bulk-update`,describe:"Update multiple IPsec tunnels associated with an account. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes.",builder:Kn,handler:async t=>{let n={};if(t.xMagicNewHcTarget!==void 0&&(n[`x-magic-new-hc-target`]=String(t.xMagicNewHcTarget)),t.dryRun){c({command:`cf magic-transit ipsec-tunnels bulk-update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/ipsec_tunnels`,pathParams:{},bodyKind:`json`,body:{body:t.body}});return}let a=await r(t),u=t.local?d:await e(a);if(t.accountId=u,t.body){let e=o(t.body);s(await l(`Updating`,async()=>a.put(`/accounts/${u}/magic/ipsec_tunnels`,{body:e,headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated`});return}s(await l(`Updating`,async()=>a.put(`/accounts/${u}/magic/ipsec_tunnels`,{headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated`})}};function Jn(e){return e.option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the request and response bodies will be presented using the new object format. Defaults to false.`}).option(`automatic-return-routing`,{type:`boolean`,description:`True if automatic stateful return routing should be enabled for a tunnel, false otherwise.`,default:!1}).option(`bgp-customer-asn`,{type:`number`,description:`ASN used on the customer end of the BGP session`}).option(`bgp-extra-prefixes`,{type:`string`,array:!0,description:`Prefixes in this list will be advertised to the customer device, in addition to the routes in the Magic routing table.`}).option(`bgp-md5-key`,{type:`string`,description:`MD5 key to use for session authentication.
|
|
35
|
-
|
|
36
|
-
Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the
|
|
37
|
-
key is not treated as a secret value. This is *only* supported for preventing
|
|
38
|
-
misconfiguration, not for defending against malicious attacks.
|
|
39
|
-
|
|
40
|
-
The MD5 key, if set, must be of non-zero length and consist only of the following types of
|
|
41
|
-
character:
|
|
42
|
-
|
|
43
|
-
* ASCII alphanumerics: \`[a-zA-Z0-9]\`
|
|
44
|
-
* Special characters in the set \`'!@#$%^&*()+[]{}<>/.,;:_-~\`= \\|\`
|
|
45
|
-
|
|
46
|
-
In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A),
|
|
47
|
-
quotation mark (\`"\`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed
|
|
48
|
-
(0x0C), and the question mark (\`?\`). Requests specifying an MD5 key with one or more of
|
|
49
|
-
these disallowed characters will be rejected.`}).option(`cloudflare-endpoint`,{type:`string`,description:`The IP address assigned to the Cloudflare side of the IPsec tunnel.`}).option(`custom-remote-identities-fqdn-id`,{type:`string`,description:`A custom IKE ID of type FQDN that may be used to identity the IPsec tunnel. The
|
|
50
|
-
generated IKE IDs can still be used even if this custom value is specified.
|
|
51
|
-
|
|
52
|
-
Must be of the form \`<custom label>.<account ID>.custom.ipsec.cloudflare.com\`.
|
|
53
|
-
|
|
54
|
-
This custom ID does not need to be unique. Two IPsec tunnels may have the same custom
|
|
55
|
-
fqdn_id. However, if another IPsec tunnel has the same value then the two tunnels
|
|
56
|
-
cannot have the same cloudflare_endpoint.`}).option(`customer-endpoint`,{type:`string`,description:`The IP address assigned to the customer side of the IPsec tunnel. Not required, but must be set for proactive traceroutes to work.`}).option(`description`,{type:`string`,description:`An optional description forthe IPsec tunnel.`}).option(`health-check-enabled`,{type:`boolean`,description:`Determines whether to run healthchecks for a tunnel.`,default:!0}).option(`health-check-rate`,{type:`string`,description:"How frequent the health check is run. The default value is `mid`.",choices:[`low`,`mid`,`high`],default:`mid`}).option(`health-check-target-saved`,{type:`string`,description:`The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used.`}).option(`health-check-type`,{type:`string`,description:"The type of healthcheck to run, reply or request. The default value is `reply`.",choices:[`reply`,`request`],default:`reply`}).option(`health-check-direction`,{type:`string`,description:`The direction of the flow of the healthcheck. Either unidirectional, where the probe comes to you via the tunnel and the result comes back to Cloudflare via the open Internet, or bidirectional where both the probe and result come and go via the tunnel.`,choices:[`unidirectional`,`bidirectional`],default:`unidirectional`}).option(`interface-address`,{type:`string`,description:`A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255.`}).option(`interface-address6`,{type:`string`,description:`A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127`}).option(`name`,{type:`string`,description:`The name of the IPsec tunnel. The name cannot share a name with other tunnels.`}).option(`psk`,{type:`string`,description:`A randomly generated or provided string for use in the IPsec tunnel.`}).option(`replay-protection`,{type:`boolean`,description:"If `true`, then IPsec replay protection will be supported in the Cloudflare-to-customer direction.",default:!1}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`bgp-customer-asn`,`bgp-extra-prefixes`,`bgp-md5key`].some(t=>e[t]!==void 0)){let t=[`bgp-customer-asn`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --bgp-* flag is set`)}return!0})}const Yn={command:`create`,describe:"Creates a new IPsec tunnel associated with an account. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes.",builder:Jn,handler:async t=>{let f={};if(t.xMagicNewHcTarget!==void 0&&(f[`x-magic-new-hc-target`]=String(t.xMagicNewHcTarget)),t.dryRun){c({command:`cf magic-transit ipsec-tunnels create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/ipsec_tunnels`,pathParams:{},bodyKind:`json`,body:{automaticReturnRouting:t.automaticReturnRouting,bgpCustomerAsn:t.bgpCustomerAsn,bgpExtraPrefixes:t.bgpExtraPrefixes,bgpMd5Key:t.bgpMd5Key,cloudflareEndpoint:t.cloudflareEndpoint,customRemoteIdentitiesFqdnId:t.customRemoteIdentitiesFqdnId,customerEndpoint:t.customerEndpoint,description:t.description,healthCheckEnabled:t.healthCheckEnabled,healthCheckRate:t.healthCheckRate,healthCheckTargetSaved:t.healthCheckTargetSaved,healthCheckType:t.healthCheckType,healthCheckDirection:t.healthCheckDirection,interfaceAddress:t.interfaceAddress,interfaceAddress6:t.interfaceAddress6,name:t.name,psk:t.psk,replayProtection:t.replayProtection,body:t.body}});return}let p=await r(t),m=t.local?d:await e(p);if(t.accountId=m,t.body){let e=o(t.body);s(await l(`Creating`,async()=>p.post(`/accounts/${m}/magic/ipsec_tunnels`,{body:e,headers:Object.keys(f).length>0?f:void 0})),{successLabel:`Created`});return}t.cloudflareEndpoint===void 0&&(t.cloudflareEndpoint=await n(`cloudflare-endpoint`,`The IP address assigned to the Cloudflare side of the IPsec tunnel.`)),t.interfaceAddress===void 0&&(t.interfaceAddress=await n(`interface-address`,`A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255.`)),t.name===void 0&&(t.name=await n(`name`,`The name of the IPsec tunnel. The name cannot share a name with other tunnels.`));let h={};t.automaticReturnRouting!==void 0&&a(h,[`automatic_return_routing`],t.automaticReturnRouting),t.bgpCustomerAsn!==void 0&&a(h,[`bgp`,`customer_asn`],t.bgpCustomerAsn),t.bgpExtraPrefixes!==void 0&&a(h,[`bgp`,`extra_prefixes`],t.bgpExtraPrefixes),t.bgpMd5Key!==void 0&&a(h,[`bgp`,`md5_key`],u(t.bgpMd5Key,`bgpMd5Key`,`text`)),t.cloudflareEndpoint!==void 0&&a(h,[`cloudflare_endpoint`],u(t.cloudflareEndpoint,`cloudflareEndpoint`,`text`)),t.customRemoteIdentitiesFqdnId!==void 0&&a(h,[`custom_remote_identities`,`fqdn_id`],u(t.customRemoteIdentitiesFqdnId,`customRemoteIdentitiesFqdnId`,`text`)),t.customerEndpoint!==void 0&&a(h,[`customer_endpoint`],u(t.customerEndpoint,`customerEndpoint`,`text`)),t.description!==void 0&&a(h,[`description`],u(t.description,`description`,`text`)),t.healthCheckEnabled!==void 0&&a(h,[`health_check`,`enabled`],t.healthCheckEnabled),t.healthCheckRate!==void 0&&a(h,[`health_check`,`rate`],u(t.healthCheckRate,`healthCheckRate`,`text`)),t.healthCheckTargetSaved!==void 0&&a(h,[`health_check`,`target`,`saved`],u(t.healthCheckTargetSaved,`healthCheckTargetSaved`,`text`)),t.healthCheckType!==void 0&&a(h,[`health_check`,`type`],u(t.healthCheckType,`healthCheckType`,`text`)),t.healthCheckDirection!==void 0&&a(h,[`health_check`,`direction`],u(t.healthCheckDirection,`healthCheckDirection`,`text`)),t.interfaceAddress!==void 0&&a(h,[`interface_address`],u(t.interfaceAddress,`interfaceAddress`,`text`)),t.interfaceAddress6!==void 0&&a(h,[`interface_address6`],u(t.interfaceAddress6,`interfaceAddress6`,`text`)),t.name!==void 0&&a(h,[`name`],u(t.name,`name`,`text`)),t.psk!==void 0&&a(h,[`psk`],u(t.psk,`psk`,`text`)),t.replayProtection!==void 0&&a(h,[`replay_protection`],t.replayProtection),s(await l(`Creating`,async()=>p.post(`/accounts/${m}/magic/ipsec_tunnels`,{body:Object.keys(h).length>0?h:void 0,headers:Object.keys(f).length>0?f:void 0})),{successLabel:`Created`})}};function Xn(e){return e.positional(`ipsecTunnelId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the response body will be presented using the new object format. Defaults to false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Zn={command:`delete <ipsecTunnelId>`,describe:"Disables and removes a specific static IPsec Tunnel associated with an account. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes.",builder:Xn,handler:async n=>{let a={};if(n.xMagicNewHcTarget!==void 0&&(a[`x-magic-new-hc-target`]=String(n.xMagicNewHcTarget)),n.dryRun){c({command:`cf magic-transit ipsec-tunnels delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/ipsec_tunnels/${n.ipsecTunnelId??`<ipsecTunnelId>`}`,pathParams:{ipsecTunnelId:String(n.ipsecTunnelId??``)},bodyKind:`json`,body:{body:n.body}});return}let u=await r(n),f=n.local?d:await e(u);if(n.accountId=f,!await t({force:!!n.force})){process.stderr.write(`Aborted.
|
|
57
|
-
`);return}if(n.body){let e=o(n.body);s(await l(`Deleting`,async()=>u.delete(`/accounts/${f}/magic/ipsec_tunnels/${n.ipsecTunnelId}`,{body:e,headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Deleted`});return}s(await l(`Deleting`,async()=>u.delete(`/accounts/${f}/magic/ipsec_tunnels/${n.ipsecTunnelId}`,{headers:Object.keys(a).length>0?a:void 0})),{successLabel:`Deleted`})}};function Qn(e){return e.positional(`ipsecTunnelId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the response body will be presented using the new object format. Defaults to false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $n={command:`get <ipsecTunnelId>`,describe:`Lists details for a specific IPsec tunnel.`,builder:Qn,handler:async t=>{let n={};if(t.xMagicNewHcTarget!==void 0&&(n[`x-magic-new-hc-target`]=String(t.xMagicNewHcTarget)),t.dryRun){c({command:`cf magic-transit ipsec-tunnels get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/ipsec_tunnels/${t.ipsecTunnelId??`<ipsecTunnelId>`}`,pathParams:{ipsecTunnelId:String(t.ipsecTunnelId??``)},bodyKind:`none`});return}let a=await r(t),o=t.local?d:await e(a);t.accountId=o,s(await l(`Loading`,async()=>a.get(`/accounts/${o}/magic/ipsec_tunnels/${t.ipsecTunnelId}`,{headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Loaded`})}};function er(e){return e.option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the response body will be presented using the new object format. Defaults to false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const tr={command:`list`,describe:`Lists IPsec tunnels associated with an account.`,builder:er,handler:async t=>{let n={};if(t.xMagicNewHcTarget!==void 0&&(n[`x-magic-new-hc-target`]=String(t.xMagicNewHcTarget)),t.dryRun){c({command:`cf magic-transit ipsec-tunnels list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/ipsec_tunnels`,pathParams:{},bodyKind:`none`});return}let a=await r(t),o=t.local?d:await e(a);t.accountId=o,s(await l(`Loading`,async()=>a.get(`/accounts/${o}/magic/ipsec_tunnels`,{headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Loaded`})}};function nr(e){return e.positional(`ipsecTunnelId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const rr={command:`psk-generate <ipsecTunnelId>`,describe:"Generates a Pre Shared Key for a specific IPsec tunnel used in the IKE session. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes. After a PSK is generated, the PSK is immediately persisted to Cloudflare's edge and cannot be retrieved later. Note the PSK in a safe place.",builder:nr,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit ipsec-tunnels psk-generate`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/ipsec_tunnels/${t.ipsecTunnelId??`<ipsecTunnelId>`}/psk_generate`,pathParams:{ipsecTunnelId:String(t.ipsecTunnelId??``)},bodyKind:`json`,body:{body:t.body}});return}let n=await r(t),a=t.local?d:await e(n);if(t.accountId=a,t.body){let e=o(t.body);s(await l(`Creating`,async()=>n.post(`/accounts/${a}/magic/ipsec_tunnels/${t.ipsecTunnelId}/psk_generate`,{body:e})),{successLabel:`Created`});return}s(await l(`Creating`,async()=>n.magicTransit.ipsecTunnels.pskGenerate(t.ipsecTunnelId,a)),{successLabel:`Created`})}};function ir(e){return e.positional(`ipsecTunnelId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the request and response bodies will be presented using the new object format. Defaults to false.`}).option(`automatic-return-routing`,{type:`boolean`,description:`True if automatic stateful return routing should be enabled for a tunnel, false otherwise.`,default:!1}).option(`bgp-customer-asn`,{type:`number`,description:`ASN used on the customer end of the BGP session`}).option(`bgp-extra-prefixes`,{type:`string`,array:!0,description:`Prefixes in this list will be advertised to the customer device, in addition to the routes in the Magic routing table.`}).option(`bgp-md5-key`,{type:`string`,description:`MD5 key to use for session authentication.
|
|
58
|
-
|
|
59
|
-
Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the
|
|
60
|
-
key is not treated as a secret value. This is *only* supported for preventing
|
|
61
|
-
misconfiguration, not for defending against malicious attacks.
|
|
62
|
-
|
|
63
|
-
The MD5 key, if set, must be of non-zero length and consist only of the following types of
|
|
64
|
-
character:
|
|
65
|
-
|
|
66
|
-
* ASCII alphanumerics: \`[a-zA-Z0-9]\`
|
|
67
|
-
* Special characters in the set \`'!@#$%^&*()+[]{}<>/.,;:_-~\`= \\|\`
|
|
68
|
-
|
|
69
|
-
In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A),
|
|
70
|
-
quotation mark (\`"\`), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed
|
|
71
|
-
(0x0C), and the question mark (\`?\`). Requests specifying an MD5 key with one or more of
|
|
72
|
-
these disallowed characters will be rejected.`}).option(`cloudflare-endpoint`,{type:`string`,description:`The IP address assigned to the Cloudflare side of the IPsec tunnel.`}).option(`custom-remote-identities-fqdn-id`,{type:`string`,description:`A custom IKE ID of type FQDN that may be used to identity the IPsec tunnel. The
|
|
73
|
-
generated IKE IDs can still be used even if this custom value is specified.
|
|
74
|
-
|
|
75
|
-
Must be of the form \`<custom label>.<account ID>.custom.ipsec.cloudflare.com\`.
|
|
76
|
-
|
|
77
|
-
This custom ID does not need to be unique. Two IPsec tunnels may have the same custom
|
|
78
|
-
fqdn_id. However, if another IPsec tunnel has the same value then the two tunnels
|
|
79
|
-
cannot have the same cloudflare_endpoint.`}).option(`customer-endpoint`,{type:`string`,description:`The IP address assigned to the customer side of the IPsec tunnel. Not required, but must be set for proactive traceroutes to work.`}).option(`description`,{type:`string`,description:`An optional description forthe IPsec tunnel.`}).option(`health-check-enabled`,{type:`boolean`,description:`Determines whether to run healthchecks for a tunnel.`,default:!0}).option(`health-check-rate`,{type:`string`,description:"How frequent the health check is run. The default value is `mid`.",choices:[`low`,`mid`,`high`],default:`mid`}).option(`health-check-target-saved`,{type:`string`,description:`The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used.`}).option(`health-check-type`,{type:`string`,description:"The type of healthcheck to run, reply or request. The default value is `reply`.",choices:[`reply`,`request`],default:`reply`}).option(`health-check-direction`,{type:`string`,description:`The direction of the flow of the healthcheck. Either unidirectional, where the probe comes to you via the tunnel and the result comes back to Cloudflare via the open Internet, or bidirectional where both the probe and result come and go via the tunnel.`,choices:[`unidirectional`,`bidirectional`],default:`unidirectional`}).option(`interface-address`,{type:`string`,description:`A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255.`}).option(`interface-address6`,{type:`string`,description:`A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127`}).option(`name`,{type:`string`,description:`The name of the IPsec tunnel. The name cannot share a name with other tunnels.`}).option(`psk`,{type:`string`,description:`A randomly generated or provided string for use in the IPsec tunnel.`}).option(`replay-protection`,{type:`boolean`,description:"If `true`, then IPsec replay protection will be supported in the Cloudflare-to-customer direction.",default:!1}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`bgp-customer-asn`,`bgp-extra-prefixes`,`bgp-md5key`].some(t=>e[t]!==void 0)){let t=[`bgp-customer-asn`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --bgp-* flag is set`)}return!0})}const ar={command:`update <ipsecTunnelId>`,describe:"Updates a specific IPsec tunnel associated with an account. Use `?validate_only=true` as an optional query parameter to only run validation without persisting changes.",builder:ir,handler:async t=>{let f={};if(t.xMagicNewHcTarget!==void 0&&(f[`x-magic-new-hc-target`]=String(t.xMagicNewHcTarget)),t.dryRun){c({command:`cf magic-transit ipsec-tunnels update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/ipsec_tunnels/${t.ipsecTunnelId??`<ipsecTunnelId>`}`,pathParams:{ipsecTunnelId:String(t.ipsecTunnelId??``)},bodyKind:`json`,body:{automaticReturnRouting:t.automaticReturnRouting,bgpCustomerAsn:t.bgpCustomerAsn,bgpExtraPrefixes:t.bgpExtraPrefixes,bgpMd5Key:t.bgpMd5Key,cloudflareEndpoint:t.cloudflareEndpoint,customRemoteIdentitiesFqdnId:t.customRemoteIdentitiesFqdnId,customerEndpoint:t.customerEndpoint,description:t.description,healthCheckEnabled:t.healthCheckEnabled,healthCheckRate:t.healthCheckRate,healthCheckTargetSaved:t.healthCheckTargetSaved,healthCheckType:t.healthCheckType,healthCheckDirection:t.healthCheckDirection,interfaceAddress:t.interfaceAddress,interfaceAddress6:t.interfaceAddress6,name:t.name,psk:t.psk,replayProtection:t.replayProtection,body:t.body}});return}let p=await r(t),m=t.local?d:await e(p);if(t.accountId=m,t.body){let e=o(t.body);s(await l(`Updating`,async()=>p.put(`/accounts/${m}/magic/ipsec_tunnels/${t.ipsecTunnelId}`,{body:e,headers:Object.keys(f).length>0?f:void 0})),{successLabel:`Updated`});return}t.cloudflareEndpoint===void 0&&(t.cloudflareEndpoint=await n(`cloudflare-endpoint`,`The IP address assigned to the Cloudflare side of the IPsec tunnel.`)),t.interfaceAddress===void 0&&(t.interfaceAddress=await n(`interface-address`,`A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side of the tunnel. Select the subnet from the following private IP space: 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255.`)),t.name===void 0&&(t.name=await n(`name`,`The name of the IPsec tunnel. The name cannot share a name with other tunnels.`));let h={};t.automaticReturnRouting!==void 0&&a(h,[`automatic_return_routing`],t.automaticReturnRouting),t.bgpCustomerAsn!==void 0&&a(h,[`bgp`,`customer_asn`],t.bgpCustomerAsn),t.bgpExtraPrefixes!==void 0&&a(h,[`bgp`,`extra_prefixes`],t.bgpExtraPrefixes),t.bgpMd5Key!==void 0&&a(h,[`bgp`,`md5_key`],u(t.bgpMd5Key,`bgpMd5Key`,`text`)),t.cloudflareEndpoint!==void 0&&a(h,[`cloudflare_endpoint`],u(t.cloudflareEndpoint,`cloudflareEndpoint`,`text`)),t.customRemoteIdentitiesFqdnId!==void 0&&a(h,[`custom_remote_identities`,`fqdn_id`],u(t.customRemoteIdentitiesFqdnId,`customRemoteIdentitiesFqdnId`,`text`)),t.customerEndpoint!==void 0&&a(h,[`customer_endpoint`],u(t.customerEndpoint,`customerEndpoint`,`text`)),t.description!==void 0&&a(h,[`description`],u(t.description,`description`,`text`)),t.healthCheckEnabled!==void 0&&a(h,[`health_check`,`enabled`],t.healthCheckEnabled),t.healthCheckRate!==void 0&&a(h,[`health_check`,`rate`],u(t.healthCheckRate,`healthCheckRate`,`text`)),t.healthCheckTargetSaved!==void 0&&a(h,[`health_check`,`target`,`saved`],u(t.healthCheckTargetSaved,`healthCheckTargetSaved`,`text`)),t.healthCheckType!==void 0&&a(h,[`health_check`,`type`],u(t.healthCheckType,`healthCheckType`,`text`)),t.healthCheckDirection!==void 0&&a(h,[`health_check`,`direction`],u(t.healthCheckDirection,`healthCheckDirection`,`text`)),t.interfaceAddress!==void 0&&a(h,[`interface_address`],u(t.interfaceAddress,`interfaceAddress`,`text`)),t.interfaceAddress6!==void 0&&a(h,[`interface_address6`],u(t.interfaceAddress6,`interfaceAddress6`,`text`)),t.name!==void 0&&a(h,[`name`],u(t.name,`name`,`text`)),t.psk!==void 0&&a(h,[`psk`],u(t.psk,`psk`,`text`)),t.replayProtection!==void 0&&a(h,[`replay_protection`],t.replayProtection),s(await l(`Updating`,async()=>p.put(`/accounts/${m}/magic/ipsec_tunnels/${t.ipsecTunnelId}`,{body:Object.keys(h).length>0?h:void 0,headers:Object.keys(f).length>0?f:void 0})),{successLabel:`Updated`})}},or={command:`ipsec-tunnels`,describe:`IPsec tunnel endpoints with pre-shared key management for encrypted transit`,builder:e=>e.command(qn).command(Yn).command(Zn).command($n).command(tr).command(rr).command(ar).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function sr(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const cr={command:`create`,describe:`Create new PCAP request for account.`,builder:sr,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit pcaps create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/pcaps`,pathParams:{},bodyKind:`json`,body:{body:t.body}});return}let n=await r(t),a=t.local?d:await e(n);if(t.accountId=a,t.body){let e=o(t.body);s(await l(`Creating`,async()=>n.post(`/accounts/${a}/pcaps`,{body:e})),{successLabel:`Created`});return}s(await l(`Creating`,async()=>n.magicTransit.pcaps.create(a)),{successLabel:`Created`})}};function lr(e){return e.positional(`pcapId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const ur={command:`get <pcapId>`,describe:`Download PCAP information into a file. Response is a binary PCAP file.`,builder:lr,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit pcaps download get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/pcaps/${t.pcapId??`<pcapId>`}/download`,pathParams:{pcapId:String(t.pcapId??``)},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a;let o=await l(`Loading`,async()=>p(`/accounts/${a}/pcaps/${t.pcapId}/download`,{method:`GET`,localEndpoint:t.local?t.localEndpoint:void 0}));f(t.text===!0?o.toString(`utf-8`):o)}},dr={command:`download`,describe:`Packet capture requests for debugging traffic flowing through Magic Transit tunnels`,builder:e=>e.command(ur).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function fr(e){return e.positional(`pcapId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const pr={command:`get <pcapId>`,describe:`Get information for a PCAP request by id.`,builder:fr,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit pcaps get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/pcaps/${t.pcapId??`<pcapId>`}`,pathParams:{pcapId:String(t.pcapId??``)},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.magicTransit.pcaps.get(t.pcapId,a)),{successLabel:`Loaded`})}};function mr(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const hr={command:`list`,describe:`Lists all packet capture requests for an account.`,builder:mr,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit pcaps list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/pcaps`,pathParams:{},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.magicTransit.pcaps.list(a)),{successLabel:`Loaded`})}};function gr(e){return e.option(`destination-conf`,{type:`string`,description:"The full URI for the bucket. This field only applies to `full` packet captures."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const _r={command:`create`,describe:`Adds an AWS or GCP bucket to use with full packet captures.`,builder:gr,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit pcaps ownership create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/pcaps/ownership`,pathParams:{},bodyKind:`json`,body:{destinationConf:t.destinationConf,body:t.body}});return}let f=await r(t),p=t.local?d:await e(f);if(t.accountId=p,t.body){let e=o(t.body);s(await l(`Creating`,async()=>f.post(`/accounts/${p}/pcaps/ownership`,{body:e})),{successLabel:`Created`});return}t.destinationConf===void 0&&(t.destinationConf=await n(`destination-conf`,"The full URI for the bucket. This field only applies to `full` packet captures."));let m={};t.destinationConf!==void 0&&a(m,[`destination_conf`],u(t.destinationConf,`destinationConf`,`text`)),s(await l(`Creating`,async()=>f.post(`/accounts/${p}/pcaps/ownership`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function vr(e){return e.positional(`ownershipId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const yr={command:`delete <ownershipId>`,describe:`Deletes buckets added to the packet captures API.`,builder:vr,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit pcaps ownership delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/pcaps/ownership/${n.ownershipId??`<ownershipId>`}`,pathParams:{ownershipId:String(n.ownershipId??``)},bodyKind:`none`});return}let a=await r(n),o=n.local?d:await e(a);if(n.accountId=o,!await t({force:!!n.force})){process.stderr.write(`Aborted.
|
|
80
|
-
`);return}s(await l(`Deleting`,async()=>a.magicTransit.pcaps.ownership.delete(n.ownershipId,o)),{successLabel:`Deleted`})}};function br(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const xr={command:`get`,describe:`List all buckets configured for use with PCAPs API.`,builder:br,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit pcaps ownership get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/pcaps/ownership`,pathParams:{},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.magicTransit.pcaps.ownership.get(a)),{successLabel:`Loaded`})}};function Sr(e){return e.option(`destination-conf`,{type:`string`,description:"The full URI for the bucket. This field only applies to `full` packet captures."}).option(`ownership-challenge`,{type:`string`,description:`The ownership challenge filename stored in the bucket.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Cr={command:`validate`,describe:`Validates buckets added to the packet captures API.`,builder:Sr,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit pcaps ownership validate`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/pcaps/ownership/validate`,pathParams:{},bodyKind:`json`,body:{destinationConf:t.destinationConf,ownershipChallenge:t.ownershipChallenge,body:t.body}});return}let f=await r(t),p=t.local?d:await e(f);if(t.accountId=p,t.body){let e=o(t.body);s(await l(`Creating`,async()=>f.post(`/accounts/${p}/pcaps/ownership/validate`,{body:e})),{successLabel:`Created`});return}t.destinationConf===void 0&&(t.destinationConf=await n(`destination-conf`,"The full URI for the bucket. This field only applies to `full` packet captures.")),t.ownershipChallenge===void 0&&(t.ownershipChallenge=await n(`ownership-challenge`,`The ownership challenge filename stored in the bucket.`));let m={};t.destinationConf!==void 0&&a(m,[`destination_conf`],u(t.destinationConf,`destinationConf`,`text`)),t.ownershipChallenge!==void 0&&a(m,[`ownership_challenge`],u(t.ownershipChallenge,`ownershipChallenge`,`text`)),s(await l(`Creating`,async()=>f.post(`/accounts/${p}/pcaps/ownership/validate`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}},wr={command:`ownership`,describe:`Packet capture requests for debugging traffic flowing through Magic Transit tunnels`,builder:e=>e.command(_r).command(yr).command(xr).command(Cr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Tr(e){return e.positional(`pcapId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Er={command:`stop <pcapId>`,describe:`Stop full PCAP.`,builder:Tr,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit pcaps stop`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/pcaps/${n.pcapId??`<pcapId>`}/stop`,pathParams:{pcapId:String(n.pcapId??``)},bodyKind:`none`});return}let a=await r(n),o=n.local?d:await e(a);if(n.accountId=o,!await t({force:!!n.force,message:`This operation halts an in-progress full packet capture. Any unsaved capture data will be lost.`})){process.stderr.write(`Aborted.
|
|
81
|
-
`);return}s(await l(`Deleting`,async()=>a.magicTransit.pcaps.stop(n.pcapId,o)),{successLabel:`Deleted`})}},Dr={command:`pcaps`,describe:`Packet capture requests for debugging traffic flowing through Magic Transit tunnels`,builder:e=>e.command(cr).command(pr).command(hr).command(Er).command(dr).command(wr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Or(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const kr={command:`bulk-update`,describe:"Update multiple Magic static routes. Use `?validate_only=true` as an optional query parameter to run validation only without persisting changes. Only fields for a route that need to be changed need be provided.",builder:Or,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit routes bulk-update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/routes`,pathParams:{},bodyKind:`json`,body:{body:t.body}});return}let n=await r(t),a=t.local?d:await e(n);if(t.accountId=a,t.body){let e=o(t.body);s(await l(`Updating`,async()=>n.put(`/accounts/${a}/magic/routes`,{body:e})),{successLabel:`Updated`});return}s(await l(`Updating`,async()=>n.magicTransit.routes.bulkUpdate(a)),{successLabel:`Updated`})}};function Ar(e){return e.option(`description`,{type:`string`,description:`An optional human provided description of the static route.`}).option(`nexthop`,{type:`string`,description:`The next-hop IP Address for the static route.`}).option(`prefix`,{type:`string`,description:`IP Prefix in Classless Inter-Domain Routing format.`}).option(`priority`,{type:`number`,description:`Priority of the static route.`}).option(`scope-colo-names`,{type:`string`,array:!0,description:`List of colo names for the ECMP scope.`}).option(`scope-colo-regions`,{type:`string`,array:!0,description:`List of colo regions for the ECMP scope.`}).option(`weight`,{type:`number`,description:`Optional weight of the ECMP scope - if provided.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const jr={command:`create`,describe:"Creates a new Magic static route. Use `?validate_only=true` as an optional query parameter to run validation only without persisting changes.",builder:Ar,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit routes create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/routes`,pathParams:{},bodyKind:`json`,body:{description:t.description,nexthop:t.nexthop,prefix:t.prefix,priority:t.priority,scopeColoNames:t.scopeColoNames,scopeColoRegions:t.scopeColoRegions,weight:t.weight,body:t.body}});return}let f=await r(t),p=t.local?d:await e(f);if(t.accountId=p,t.body){let e=o(t.body);s(await l(`Creating`,async()=>f.post(`/accounts/${p}/magic/routes`,{body:e})),{successLabel:`Created`});return}if(t.nexthop===void 0&&(t.nexthop=await n(`nexthop`,`The next-hop IP Address for the static route.`)),t.prefix===void 0&&(t.prefix=await n(`prefix`,`IP Prefix in Classless Inter-Domain Routing format.`)),t.priority===void 0)throw Error(`--priority is required (or pass --body with this field set).`);let m={};t.description!==void 0&&a(m,[`description`],u(t.description,`description`,`text`)),t.nexthop!==void 0&&a(m,[`nexthop`],u(t.nexthop,`nexthop`,`text`)),t.prefix!==void 0&&a(m,[`prefix`],u(t.prefix,`prefix`,`text`)),t.priority!==void 0&&a(m,[`priority`],t.priority),t.scopeColoNames!==void 0&&a(m,[`scope`,`colo_names`],t.scopeColoNames),t.scopeColoRegions!==void 0&&a(m,[`scope`,`colo_regions`],t.scopeColoRegions),t.weight!==void 0&&a(m,[`weight`],t.weight),s(await l(`Creating`,async()=>f.post(`/accounts/${p}/magic/routes`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function Mr(e){return e.positional(`routeId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Nr={command:`delete <routeId>`,describe:`Disable and remove a specific Magic static route.`,builder:Mr,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit routes delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/routes/${n.routeId??`<routeId>`}`,pathParams:{routeId:String(n.routeId??``)},bodyKind:`json`,body:{body:n.body}});return}let a=await r(n),u=n.local?d:await e(a);if(n.accountId=u,!await t({force:!!n.force})){process.stderr.write(`Aborted.
|
|
82
|
-
`);return}if(n.body){let e=o(n.body);s(await l(`Deleting`,async()=>a.delete(`/accounts/${u}/magic/routes/${n.routeId}`,{body:e})),{successLabel:`Deleted`});return}s(await l(`Deleting`,async()=>a.magicTransit.routes.delete(n.routeId,u)),{successLabel:`Deleted`})}};function Pr(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Fr={command:`empty`,describe:`Delete multiple Magic static routes.`,builder:Pr,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit routes empty`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/routes`,pathParams:{},bodyKind:`json`,body:{body:n.body}});return}let a=await r(n),u=n.local?d:await e(a);if(n.accountId=u,!await t({force:!!n.force})){process.stderr.write(`Aborted.
|
|
83
|
-
`);return}if(n.body){let e=o(n.body);s(await l(`Deleting`,async()=>a.delete(`/accounts/${u}/magic/routes`,{body:e})),{successLabel:`Deleted`});return}s(await l(`Deleting`,async()=>a.magicTransit.routes.empty(u)),{successLabel:`Deleted`})}};function Ir(e){return e.positional(`routeId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Lr={command:`get <routeId>`,describe:`Get a specific Magic static route.`,builder:Ir,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit routes get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/routes/${t.routeId??`<routeId>`}`,pathParams:{routeId:String(t.routeId??``)},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.magicTransit.routes.get(t.routeId,a)),{successLabel:`Loaded`})}};function Rr(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const zr={command:`list`,describe:`List all Magic static routes.`,builder:Rr,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit routes list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/routes`,pathParams:{},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.magicTransit.routes.list(a)),{successLabel:`Loaded`})}};function Br(e){return e.positional(`routeId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`description`,{type:`string`,description:`An optional human provided description of the static route.`}).option(`nexthop`,{type:`string`,description:`The next-hop IP Address for the static route.`}).option(`prefix`,{type:`string`,description:`IP Prefix in Classless Inter-Domain Routing format.`}).option(`priority`,{type:`number`,description:`Priority of the static route.`}).option(`scope-colo-names`,{type:`string`,array:!0,description:`List of colo names for the ECMP scope.`}).option(`scope-colo-regions`,{type:`string`,array:!0,description:`List of colo regions for the ECMP scope.`}).option(`weight`,{type:`number`,description:`Optional weight of the ECMP scope - if provided.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Vr={command:`update <routeId>`,describe:"Update a specific Magic static route. Use `?validate_only=true` as an optional query parameter to run validation only without persisting changes.",builder:Br,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit routes update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/routes/${t.routeId??`<routeId>`}`,pathParams:{routeId:String(t.routeId??``)},bodyKind:`json`,body:{description:t.description,nexthop:t.nexthop,prefix:t.prefix,priority:t.priority,scopeColoNames:t.scopeColoNames,scopeColoRegions:t.scopeColoRegions,weight:t.weight,body:t.body}});return}let f=await r(t),p=t.local?d:await e(f);if(t.accountId=p,t.body){let e=o(t.body);s(await l(`Updating`,async()=>f.put(`/accounts/${p}/magic/routes/${t.routeId}`,{body:e})),{successLabel:`Updated`});return}if(t.nexthop===void 0&&(t.nexthop=await n(`nexthop`,`The next-hop IP Address for the static route.`)),t.prefix===void 0&&(t.prefix=await n(`prefix`,`IP Prefix in Classless Inter-Domain Routing format.`)),t.priority===void 0)throw Error(`--priority is required (or pass --body with this field set).`);let m={};t.description!==void 0&&a(m,[`description`],u(t.description,`description`,`text`)),t.nexthop!==void 0&&a(m,[`nexthop`],u(t.nexthop,`nexthop`,`text`)),t.prefix!==void 0&&a(m,[`prefix`],u(t.prefix,`prefix`,`text`)),t.priority!==void 0&&a(m,[`priority`],t.priority),t.scopeColoNames!==void 0&&a(m,[`scope`,`colo_names`],t.scopeColoNames),t.scopeColoRegions!==void 0&&a(m,[`scope`,`colo_regions`],t.scopeColoRegions),t.weight!==void 0&&a(m,[`weight`],t.weight),s(await l(`Updating`,async()=>f.put(`/accounts/${p}/magic/routes/${t.routeId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated`})}},Hr={command:`routes`,describe:`Static routes that direct IP prefix traffic through specific GRE/IPsec tunnels`,builder:e=>e.command(kr).command(jr).command(Nr).command(Fr).command(Lr).command(zr).command(Vr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ur(e){return e.positional(`siteId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`description`,{type:`string`,description:`Description for the ACL.`}).option(`forward-locally`,{type:`boolean`,description:`The desired forwarding action for this ACL policy. If set to "false", the policy will forward traffic to Cloudflare. If set to "true", the policy will forward traffic locally on the Magic Connector. If not included in request, will default to false.`}).option(`lan-1-lan-id`,{type:`string`,description:`The identifier for the LAN you want to create an ACL policy with.`}).option(`lan-1-lan-name`,{type:`string`,description:`The name of the LAN based on the provided lan_id.`}).option(`lan-1-port-ranges`,{type:`string`,array:!0,description:`Array of port ranges on the provided LAN that will be included in the ACL. If no ports or port rangess are provided, communication on any port on this LAN is allowed.`}).option(`lan-1-ports`,{type:`string`,array:!0,description:`Array of ports on the provided LAN that will be included in the ACL. If no ports or port ranges are provided, communication on any port on this LAN is allowed.`}).option(`lan-2-lan-id`,{type:`string`,description:`The identifier for the LAN you want to create an ACL policy with.`}).option(`lan-2-lan-name`,{type:`string`,description:`The name of the LAN based on the provided lan_id.`}).option(`lan-2-port-ranges`,{type:`string`,array:!0,description:`Array of port ranges on the provided LAN that will be included in the ACL. If no ports or port rangess are provided, communication on any port on this LAN is allowed.`}).option(`lan-2-ports`,{type:`string`,array:!0,description:`Array of ports on the provided LAN that will be included in the ACL. If no ports or port ranges are provided, communication on any port on this LAN is allowed.`}).option(`name`,{type:`string`,description:`The name of the ACL.`}).option(`protocols`,{type:`string`,array:!0,description:`The protocols field`}).option(`unidirectional`,{type:`boolean`,description:`The desired traffic direction for this ACL policy. If set to "false", the policy will allow bidirectional traffic. If set to "true", the policy will only allow traffic in one direction. If not included in request, will default to false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Bidirectional ACL policy for local network traffic within a site.`})}const Wr={command:`create <siteId>`,describe:`Creates a new Site ACL.`,builder:Ur,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit sites acls create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${t.siteId??`<siteId>`}/acls`,pathParams:{siteId:String(t.siteId??``)},bodyKind:`json`,body:{description:t.description,forwardLocally:t.forwardLocally,lan1LanId:t.lan1LanId,lan1LanName:t.lan1LanName,lan1PortRanges:t.lan1PortRanges,lan1Ports:t.lan1Ports,lan2LanId:t.lan2LanId,lan2LanName:t.lan2LanName,lan2PortRanges:t.lan2PortRanges,lan2Ports:t.lan2Ports,name:t.name,protocols:t.protocols,unidirectional:t.unidirectional,body:t.body}});return}let f=await r(t),p=t.local?d:await e(f);if(t.accountId=p,t.body){let e=o(t.body);s(await l(`Creating`,async()=>f.post(`/accounts/${p}/magic/sites/${t.siteId}/acls`,{body:e})),{successLabel:`Created`});return}t.lan1LanId===void 0&&(t.lan1LanId=await n(`lan1lan-id`,`The identifier for the LAN you want to create an ACL policy with.`)),t.lan2LanId===void 0&&(t.lan2LanId=await n(`lan2lan-id`,`The identifier for the LAN you want to create an ACL policy with.`)),t.name===void 0&&(t.name=await n(`name`,`The name of the ACL.`));let m={};t.description!==void 0&&a(m,[`description`],u(t.description,`description`,`text`)),t.forwardLocally!==void 0&&a(m,[`forward_locally`],t.forwardLocally),t.lan1LanId!==void 0&&a(m,[`lan_1`,`lan_id`],u(t.lan1LanId,`lan1LanId`,`text`)),t.lan1LanName!==void 0&&a(m,[`lan_1`,`lan_name`],u(t.lan1LanName,`lan1LanName`,`text`)),t.lan1PortRanges!==void 0&&a(m,[`lan_1`,`port_ranges`],t.lan1PortRanges),t.lan1Ports!==void 0&&a(m,[`lan_1`,`ports`],t.lan1Ports),t.lan2LanId!==void 0&&a(m,[`lan_2`,`lan_id`],u(t.lan2LanId,`lan2LanId`,`text`)),t.lan2LanName!==void 0&&a(m,[`lan_2`,`lan_name`],u(t.lan2LanName,`lan2LanName`,`text`)),t.lan2PortRanges!==void 0&&a(m,[`lan_2`,`port_ranges`],t.lan2PortRanges),t.lan2Ports!==void 0&&a(m,[`lan_2`,`ports`],t.lan2Ports),t.name!==void 0&&a(m,[`name`],u(t.name,`name`,`text`)),t.protocols!==void 0&&a(m,[`protocols`],t.protocols),t.unidirectional!==void 0&&a(m,[`unidirectional`],t.unidirectional),s(await l(`Creating`,async()=>f.post(`/accounts/${p}/magic/sites/${t.siteId}/acls`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function Gr(e){return e.positional(`aclId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Kr={command:`delete <aclId>`,describe:`Remove a specific Site ACL.`,builder:Gr,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites acls delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${n.siteId??`<siteId>`}/acls/${n.aclId??`<aclId>`}`,pathParams:{siteId:String(n.siteId??``),aclId:String(n.aclId??``)},bodyKind:`json`,body:{body:n.body}});return}let a=await r(n),u=n.local?d:await e(a);if(n.accountId=u,!await t({force:!!n.force})){process.stderr.write(`Aborted.
|
|
84
|
-
`);return}if(n.body){let e=o(n.body);s(await l(`Deleting`,async()=>a.delete(`/accounts/${u}/magic/sites/${n.siteId}/acls/${n.aclId}`,{body:e})),{successLabel:`Deleted`});return}s(await l(`Deleting`,async()=>a.magicTransit.sites.acls.delete(n.siteId,u,n.aclId)),{successLabel:`Deleted`})}};function qr(e){return e.positional(`aclId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`description`,{type:`string`,description:`Description for the ACL.`}).option(`forward-locally`,{type:`boolean`,description:`The desired forwarding action for this ACL policy. If set to "false", the policy will forward traffic to Cloudflare. If set to "true", the policy will forward traffic locally on the Magic Connector. If not included in request, will default to false.`}).option(`lan-1-lan-id`,{type:`string`,description:`The identifier for the LAN you want to create an ACL policy with.`}).option(`lan-1-lan-name`,{type:`string`,description:`The name of the LAN based on the provided lan_id.`}).option(`lan-1-port-ranges`,{type:`string`,array:!0,description:`Array of port ranges on the provided LAN that will be included in the ACL. If no ports or port rangess are provided, communication on any port on this LAN is allowed.`}).option(`lan-1-ports`,{type:`string`,array:!0,description:`Array of ports on the provided LAN that will be included in the ACL. If no ports or port ranges are provided, communication on any port on this LAN is allowed.`}).option(`lan-2-lan-id`,{type:`string`,description:`The identifier for the LAN you want to create an ACL policy with.`}).option(`lan-2-lan-name`,{type:`string`,description:`The name of the LAN based on the provided lan_id.`}).option(`lan-2-port-ranges`,{type:`string`,array:!0,description:`Array of port ranges on the provided LAN that will be included in the ACL. If no ports or port rangess are provided, communication on any port on this LAN is allowed.`}).option(`lan-2-ports`,{type:`string`,array:!0,description:`Array of ports on the provided LAN that will be included in the ACL. If no ports or port ranges are provided, communication on any port on this LAN is allowed.`}).option(`name`,{type:`string`,description:`The name of the ACL.`}).option(`protocols`,{type:`string`,array:!0,description:`The protocols field`}).option(`unidirectional`,{type:`boolean`,description:`The desired traffic direction for this ACL policy. If set to "false", the policy will allow bidirectional traffic. If set to "true", the policy will only allow traffic in one direction. If not included in request, will default to false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`lan1lan-id`,`lan1lan-name`,`lan1port-ranges`,`lan1ports`].some(t=>e[t]!==void 0)){let t=[`lan1lan-id`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --lan_1-* flag is set`)}return!0}).check(e=>{if([`lan2lan-id`,`lan2lan-name`,`lan2port-ranges`,`lan2ports`].some(t=>e[t]!==void 0)){let t=[`lan2lan-id`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --lan_2-* flag is set`)}return!0})}const Jr={command:`edit <aclId>`,describe:`Patch a specific Site ACL.`,builder:qr,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit sites acls edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${t.siteId??`<siteId>`}/acls/${t.aclId??`<aclId>`}`,pathParams:{siteId:String(t.siteId??``),aclId:String(t.aclId??``)},bodyKind:`json`,body:{description:t.description,forwardLocally:t.forwardLocally,lan1LanId:t.lan1LanId,lan1LanName:t.lan1LanName,lan1PortRanges:t.lan1PortRanges,lan1Ports:t.lan1Ports,lan2LanId:t.lan2LanId,lan2LanName:t.lan2LanName,lan2PortRanges:t.lan2PortRanges,lan2Ports:t.lan2Ports,name:t.name,protocols:t.protocols,unidirectional:t.unidirectional,body:t.body}});return}let n=await r(t),f=t.local?d:await e(n);if(t.accountId=f,t.body){let e=o(t.body);s(await l(`Updating`,async()=>n.patch(`/accounts/${f}/magic/sites/${t.siteId}/acls/${t.aclId}`,{body:e})),{successLabel:`Updated`});return}let p={};t.description!==void 0&&a(p,[`description`],u(t.description,`description`,`text`)),t.forwardLocally!==void 0&&a(p,[`forward_locally`],t.forwardLocally),t.lan1LanId!==void 0&&a(p,[`lan_1`,`lan_id`],u(t.lan1LanId,`lan1LanId`,`text`)),t.lan1LanName!==void 0&&a(p,[`lan_1`,`lan_name`],u(t.lan1LanName,`lan1LanName`,`text`)),t.lan1PortRanges!==void 0&&a(p,[`lan_1`,`port_ranges`],t.lan1PortRanges),t.lan1Ports!==void 0&&a(p,[`lan_1`,`ports`],t.lan1Ports),t.lan2LanId!==void 0&&a(p,[`lan_2`,`lan_id`],u(t.lan2LanId,`lan2LanId`,`text`)),t.lan2LanName!==void 0&&a(p,[`lan_2`,`lan_name`],u(t.lan2LanName,`lan2LanName`,`text`)),t.lan2PortRanges!==void 0&&a(p,[`lan_2`,`port_ranges`],t.lan2PortRanges),t.lan2Ports!==void 0&&a(p,[`lan_2`,`ports`],t.lan2Ports),t.name!==void 0&&a(p,[`name`],u(t.name,`name`,`text`)),t.protocols!==void 0&&a(p,[`protocols`],t.protocols),t.unidirectional!==void 0&&a(p,[`unidirectional`],t.unidirectional),s(await l(`Updating`,async()=>n.patch(`/accounts/${f}/magic/sites/${t.siteId}/acls/${t.aclId}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}};function Yr(e){return e.positional(`aclId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Xr={command:`get <aclId>`,describe:`Get a specific Site ACL.`,builder:Yr,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit sites acls get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${t.siteId??`<siteId>`}/acls/${t.aclId??`<aclId>`}`,pathParams:{siteId:String(t.siteId??``),aclId:String(t.aclId??``)},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.magicTransit.sites.acls.get(t.siteId,a,t.aclId)),{successLabel:`Loaded`})}};function Zr(e){return e.option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Qr={command:`list`,describe:`Lists Site ACLs associated with an account.`,builder:Zr,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit sites acls list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${t.siteId??`<siteId>`}/acls`,pathParams:{siteId:String(t.siteId??``)},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.magicTransit.sites.acls.list(a,t.siteId)),{successLabel:`Loaded`})}};function $r(e){return e.positional(`aclId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`description`,{type:`string`,description:`Description for the ACL.`}).option(`forward-locally`,{type:`boolean`,description:`The desired forwarding action for this ACL policy. If set to "false", the policy will forward traffic to Cloudflare. If set to "true", the policy will forward traffic locally on the Magic Connector. If not included in request, will default to false.`}).option(`lan-1-lan-id`,{type:`string`,description:`The identifier for the LAN you want to create an ACL policy with.`}).option(`lan-1-lan-name`,{type:`string`,description:`The name of the LAN based on the provided lan_id.`}).option(`lan-1-port-ranges`,{type:`string`,array:!0,description:`Array of port ranges on the provided LAN that will be included in the ACL. If no ports or port rangess are provided, communication on any port on this LAN is allowed.`}).option(`lan-1-ports`,{type:`string`,array:!0,description:`Array of ports on the provided LAN that will be included in the ACL. If no ports or port ranges are provided, communication on any port on this LAN is allowed.`}).option(`lan-2-lan-id`,{type:`string`,description:`The identifier for the LAN you want to create an ACL policy with.`}).option(`lan-2-lan-name`,{type:`string`,description:`The name of the LAN based on the provided lan_id.`}).option(`lan-2-port-ranges`,{type:`string`,array:!0,description:`Array of port ranges on the provided LAN that will be included in the ACL. If no ports or port rangess are provided, communication on any port on this LAN is allowed.`}).option(`lan-2-ports`,{type:`string`,array:!0,description:`Array of ports on the provided LAN that will be included in the ACL. If no ports or port ranges are provided, communication on any port on this LAN is allowed.`}).option(`name`,{type:`string`,description:`The name of the ACL.`}).option(`protocols`,{type:`string`,array:!0,description:`The protocols field`}).option(`unidirectional`,{type:`boolean`,description:`The desired traffic direction for this ACL policy. If set to "false", the policy will allow bidirectional traffic. If set to "true", the policy will only allow traffic in one direction. If not included in request, will default to false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`lan1lan-id`,`lan1lan-name`,`lan1port-ranges`,`lan1ports`].some(t=>e[t]!==void 0)){let t=[`lan1lan-id`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --lan_1-* flag is set`)}return!0}).check(e=>{if([`lan2lan-id`,`lan2lan-name`,`lan2port-ranges`,`lan2ports`].some(t=>e[t]!==void 0)){let t=[`lan2lan-id`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --lan_2-* flag is set`)}return!0})}const ei={command:`update <aclId>`,describe:`Update a specific Site ACL.`,builder:$r,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit sites acls update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${t.siteId??`<siteId>`}/acls/${t.aclId??`<aclId>`}`,pathParams:{siteId:String(t.siteId??``),aclId:String(t.aclId??``)},bodyKind:`json`,body:{description:t.description,forwardLocally:t.forwardLocally,lan1LanId:t.lan1LanId,lan1LanName:t.lan1LanName,lan1PortRanges:t.lan1PortRanges,lan1Ports:t.lan1Ports,lan2LanId:t.lan2LanId,lan2LanName:t.lan2LanName,lan2PortRanges:t.lan2PortRanges,lan2Ports:t.lan2Ports,name:t.name,protocols:t.protocols,unidirectional:t.unidirectional,body:t.body}});return}let n=await r(t),f=t.local?d:await e(n);if(t.accountId=f,t.body){let e=o(t.body);s(await l(`Updating`,async()=>n.put(`/accounts/${f}/magic/sites/${t.siteId}/acls/${t.aclId}`,{body:e})),{successLabel:`Updated`});return}let p={};t.description!==void 0&&a(p,[`description`],u(t.description,`description`,`text`)),t.forwardLocally!==void 0&&a(p,[`forward_locally`],t.forwardLocally),t.lan1LanId!==void 0&&a(p,[`lan_1`,`lan_id`],u(t.lan1LanId,`lan1LanId`,`text`)),t.lan1LanName!==void 0&&a(p,[`lan_1`,`lan_name`],u(t.lan1LanName,`lan1LanName`,`text`)),t.lan1PortRanges!==void 0&&a(p,[`lan_1`,`port_ranges`],t.lan1PortRanges),t.lan1Ports!==void 0&&a(p,[`lan_1`,`ports`],t.lan1Ports),t.lan2LanId!==void 0&&a(p,[`lan_2`,`lan_id`],u(t.lan2LanId,`lan2LanId`,`text`)),t.lan2LanName!==void 0&&a(p,[`lan_2`,`lan_name`],u(t.lan2LanName,`lan2LanName`,`text`)),t.lan2PortRanges!==void 0&&a(p,[`lan_2`,`port_ranges`],t.lan2PortRanges),t.lan2Ports!==void 0&&a(p,[`lan_2`,`ports`],t.lan2Ports),t.name!==void 0&&a(p,[`name`],u(t.name,`name`,`text`)),t.protocols!==void 0&&a(p,[`protocols`],t.protocols),t.unidirectional!==void 0&&a(p,[`unidirectional`],t.unidirectional),s(await l(`Updating`,async()=>n.put(`/accounts/${f}/magic/sites/${t.siteId}/acls/${t.aclId}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}},ti={command:`acls`,describe:`Magic WAN branch sites with LAN/WAN interface configuration and connector assignments`,builder:e=>e.command(Wr).command(Kr).command(Jr).command(Xr).command(Qr).command(ei).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ni(e){return e.positional(`siteId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`breakout`,{type:`boolean`,description:`Whether to breakout traffic to the app's endpoints directly. Null preserves default behavior.`}).option(`preferred-wans`,{type:`string`,array:!0,description:`WAN interfaces to prefer over default WANs, highest-priority first. Can only be specified for breakout rules (breakout must be true).`}).option(`priority`,{type:`number`,description:`Priority of traffic. 0 is default, anything greater is prioritized. (Currently only 0 and 1 are supported)`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ri={command:`create <siteId>`,describe:`Creates a new App Config for a site`,builder:ni,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit sites app-configuration create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${t.siteId??`<siteId>`}/app_configs`,pathParams:{siteId:String(t.siteId??``)},bodyKind:`json`,body:{breakout:t.breakout,preferredWans:t.preferredWans,priority:t.priority,body:t.body}});return}let n=await r(t),u=t.local?d:await e(n);if(t.accountId=u,t.body){let e=o(t.body);s(await l(`Creating`,async()=>n.post(`/accounts/${u}/magic/sites/${t.siteId}/app_configs`,{body:e})),{successLabel:`Created`});return}let f={};t.breakout!==void 0&&a(f,[`breakout`],t.breakout),t.preferredWans!==void 0&&a(f,[`preferred_wans`],t.preferredWans),t.priority!==void 0&&a(f,[`priority`],t.priority),s(await l(`Creating`,async()=>n.post(`/accounts/${u}/magic/sites/${t.siteId}/app_configs`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Created`})}};function ii(e){return e.positional(`appConfigId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const ai={command:`delete <appConfigId>`,describe:`Deletes specific App Config associated with a site.`,builder:ii,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites app-configuration delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${n.siteId??`<siteId>`}/app_configs/${n.appConfigId??`<appConfigId>`}`,pathParams:{siteId:String(n.siteId??``),appConfigId:String(n.appConfigId??``)},bodyKind:`none`});return}let a=await r(n),o=n.local?d:await e(a);if(n.accountId=o,!await t({force:!!n.force})){process.stderr.write(`Aborted.
|
|
85
|
-
`);return}s(await l(`Deleting`,async()=>a.magicTransit.sites.appConfiguration.delete(o,n.siteId,n.appConfigId)),{successLabel:`Deleted`})}};function oi(e){return e.positional(`appConfigId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`account-app-id`,{type:`string`,description:`Magic account app ID.`}).option(`breakout`,{type:`boolean`,description:`Whether to breakout traffic to the app's endpoints directly. Null preserves default behavior.`}).option(`managed-app-id`,{type:`string`,description:`Managed app ID.`}).option(`preferred-wans`,{type:`string`,array:!0,description:`WAN interfaces to prefer over default WANs, highest-priority first. Can only be specified for breakout rules (breakout must be true).`}).option(`priority`,{type:`number`,description:`Priority of traffic. 0 is default, anything greater is prioritized. (Currently only 0 and 1 are supported)`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const si={command:`edit <appConfigId>`,describe:`Updates an App Config for a site`,builder:oi,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit sites app-configuration edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${t.siteId??`<siteId>`}/app_configs/${t.appConfigId??`<appConfigId>`}`,pathParams:{siteId:String(t.siteId??``),appConfigId:String(t.appConfigId??``)},bodyKind:`json`,body:{accountAppId:t.accountAppId,breakout:t.breakout,managedAppId:t.managedAppId,preferredWans:t.preferredWans,priority:t.priority,body:t.body}});return}let n=await r(t),f=t.local?d:await e(n);if(t.accountId=f,t.body){let e=o(t.body);s(await l(`Updating`,async()=>n.patch(`/accounts/${f}/magic/sites/${t.siteId}/app_configs/${t.appConfigId}`,{body:e})),{successLabel:`Updated`});return}let p={};t.accountAppId!==void 0&&a(p,[`account_app_id`],u(t.accountAppId,`accountAppId`,`text`)),t.breakout!==void 0&&a(p,[`breakout`],t.breakout),t.managedAppId!==void 0&&a(p,[`managed_app_id`],u(t.managedAppId,`managedAppId`,`text`)),t.preferredWans!==void 0&&a(p,[`preferred_wans`],t.preferredWans),t.priority!==void 0&&a(p,[`priority`],t.priority),s(await l(`Updating`,async()=>n.patch(`/accounts/${f}/magic/sites/${t.siteId}/app_configs/${t.appConfigId}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}};function ci(e){return e.option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const li={command:`list`,describe:`Lists App Configs associated with a site.`,builder:ci,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit sites app-configuration list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${t.siteId??`<siteId>`}/app_configs`,pathParams:{siteId:String(t.siteId??``)},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.magicTransit.sites.appConfiguration.list(a,t.siteId)),{successLabel:`Loaded`})}};function ui(e){return e.positional(`appConfigId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`account-app-id`,{type:`string`,description:`Magic account app ID.`}).option(`breakout`,{type:`boolean`,description:`Whether to breakout traffic to the app's endpoints directly. Null preserves default behavior.`}).option(`managed-app-id`,{type:`string`,description:`Managed app ID.`}).option(`preferred-wans`,{type:`string`,array:!0,description:`WAN interfaces to prefer over default WANs, highest-priority first. Can only be specified for breakout rules (breakout must be true).`}).option(`priority`,{type:`number`,description:`Priority of traffic. 0 is default, anything greater is prioritized. (Currently only 0 and 1 are supported)`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const di={command:`update <appConfigId>`,describe:`Updates an App Config for a site`,builder:ui,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit sites app-configuration update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${t.siteId??`<siteId>`}/app_configs/${t.appConfigId??`<appConfigId>`}`,pathParams:{siteId:String(t.siteId??``),appConfigId:String(t.appConfigId??``)},bodyKind:`json`,body:{accountAppId:t.accountAppId,breakout:t.breakout,managedAppId:t.managedAppId,preferredWans:t.preferredWans,priority:t.priority,body:t.body}});return}let n=await r(t),f=t.local?d:await e(n);if(t.accountId=f,t.body){let e=o(t.body);s(await l(`Updating`,async()=>n.put(`/accounts/${f}/magic/sites/${t.siteId}/app_configs/${t.appConfigId}`,{body:e})),{successLabel:`Updated`});return}let p={};t.accountAppId!==void 0&&a(p,[`account_app_id`],u(t.accountAppId,`accountAppId`,`text`)),t.breakout!==void 0&&a(p,[`breakout`],t.breakout),t.managedAppId!==void 0&&a(p,[`managed_app_id`],u(t.managedAppId,`managedAppId`,`text`)),t.preferredWans!==void 0&&a(p,[`preferred_wans`],t.preferredWans),t.priority!==void 0&&a(p,[`priority`],t.priority),s(await l(`Updating`,async()=>n.put(`/accounts/${f}/magic/sites/${t.siteId}/app_configs/${t.appConfigId}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}},fi={command:`app-configuration`,describe:`Magic WAN site app configuration and NetFlow config management`,builder:e=>e.command(ri).command(ai).command(si).command(li).command(di).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function pi(e){return e.option(`connector-id`,{type:`string`,description:`Magic Connector identifier tag.`}).option(`description`,{type:`string`,description:`The description field`}).option(`ha-mode`,{type:`boolean`,description:`Site high availability mode. If set to true, the site can have two connectors and runs in high availability mode.`}).option(`location-lat`,{type:`string`,description:`Latitude`}).option(`location-lon`,{type:`string`,description:`Longitude`}).option(`name`,{type:`string`,description:`The name of the site.`}).option(`secondary-connector-id`,{type:`string`,description:`Magic Connector identifier tag. Used when high availability mode is on.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const mi={command:`create`,describe:`Creates a new Site`,builder:pi,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit sites create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites`,pathParams:{},bodyKind:`json`,body:{connectorId:t.connectorId,description:t.description,haMode:t.haMode,locationLat:t.locationLat,locationLon:t.locationLon,name:t.name,secondaryConnectorId:t.secondaryConnectorId,body:t.body}});return}let f=await r(t),p=t.local?d:await e(f);if(t.accountId=p,t.body){let e=o(t.body);s(await l(`Creating`,async()=>f.post(`/accounts/${p}/magic/sites`,{body:e})),{successLabel:`Created`});return}t.name===void 0&&(t.name=await n(`name`,`The name of the site.`));let m={};t.connectorId!==void 0&&a(m,[`connector_id`],u(t.connectorId,`connectorId`,`text`)),t.description!==void 0&&a(m,[`description`],u(t.description,`description`,`text`)),t.haMode!==void 0&&a(m,[`ha_mode`],t.haMode),t.locationLat!==void 0&&a(m,[`location`,`lat`],u(t.locationLat,`locationLat`,`text`)),t.locationLon!==void 0&&a(m,[`location`,`lon`],u(t.locationLon,`locationLon`,`text`)),t.name!==void 0&&a(m,[`name`],u(t.name,`name`,`text`)),t.secondaryConnectorId!==void 0&&a(m,[`secondary_connector_id`],u(t.secondaryConnectorId,`secondaryConnectorId`,`text`)),s(await l(`Creating`,async()=>f.post(`/accounts/${p}/magic/sites`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function hi(e){return e.positional(`siteId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const gi={command:`delete <siteId>`,describe:`Remove a specific Site.`,builder:hi,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${n.siteId??`<siteId>`}`,pathParams:{siteId:String(n.siteId??``)},bodyKind:`json`,body:{body:n.body}});return}let a=await r(n),u=n.local?d:await e(a);if(n.accountId=u,!await t({force:!!n.force})){process.stderr.write(`Aborted.
|
|
86
|
-
`);return}if(n.body){let e=o(n.body);s(await l(`Deleting`,async()=>a.delete(`/accounts/${u}/magic/sites/${n.siteId}`,{body:e})),{successLabel:`Deleted`});return}s(await l(`Deleting`,async()=>a.magicTransit.sites.delete(n.siteId,u)),{successLabel:`Deleted`})}};function _i(e){return e.positional(`siteId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`connector-id`,{type:`string`,description:`Magic Connector identifier tag.`}).option(`description`,{type:`string`,description:`The description field`}).option(`location-lat`,{type:`string`,description:`Latitude`}).option(`location-lon`,{type:`string`,description:`Longitude`}).option(`name`,{type:`string`,description:`The name of the site.`}).option(`secondary-connector-id`,{type:`string`,description:`Magic Connector identifier tag. Used when high availability mode is on.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const vi={command:`edit <siteId>`,describe:`Patch a specific Site.`,builder:_i,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit sites edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${t.siteId??`<siteId>`}`,pathParams:{siteId:String(t.siteId??``)},bodyKind:`json`,body:{connectorId:t.connectorId,description:t.description,locationLat:t.locationLat,locationLon:t.locationLon,name:t.name,secondaryConnectorId:t.secondaryConnectorId,body:t.body}});return}let n=await r(t),f=t.local?d:await e(n);if(t.accountId=f,t.body){let e=o(t.body);s(await l(`Updating`,async()=>n.patch(`/accounts/${f}/magic/sites/${t.siteId}`,{body:e})),{successLabel:`Updated`});return}let p={};t.connectorId!==void 0&&a(p,[`connector_id`],u(t.connectorId,`connectorId`,`text`)),t.description!==void 0&&a(p,[`description`],u(t.description,`description`,`text`)),t.locationLat!==void 0&&a(p,[`location`,`lat`],u(t.locationLat,`locationLat`,`text`)),t.locationLon!==void 0&&a(p,[`location`,`lon`],u(t.locationLon,`locationLon`,`text`)),t.name!==void 0&&a(p,[`name`],u(t.name,`name`,`text`)),t.secondaryConnectorId!==void 0&&a(p,[`secondary_connector_id`],u(t.secondaryConnectorId,`secondaryConnectorId`,`text`)),s(await l(`Updating`,async()=>n.patch(`/accounts/${f}/magic/sites/${t.siteId}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}};function yi(e){return e.positional(`siteId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`x-magic-new-hc-target`,{type:`string`,description:`If true, the health check target in the response body will be presented using the new object format. Defaults to false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const bi={command:`get <siteId>`,describe:`Get a specific Site.`,builder:yi,handler:async t=>{let n={};if(t.xMagicNewHcTarget!==void 0&&(n[`x-magic-new-hc-target`]=String(t.xMagicNewHcTarget)),t.dryRun){c({command:`cf magic-transit sites get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${t.siteId??`<siteId>`}`,pathParams:{siteId:String(t.siteId??``)},bodyKind:`none`});return}let a=await r(t),o=t.local?d:await e(a);t.accountId=o,s(await l(`Loading`,async()=>a.get(`/accounts/${o}/magic/sites/${t.siteId}`,{headers:Object.keys(n).length>0?n:void 0})),{successLabel:`Loaded`})}};function xi(e){return e.positional(`siteId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`bond-id`,{type:`number`,description:`The bond_id field`}).option(`ha-link`,{type:`boolean`,description:`mark true to use this LAN for HA probing. only works for site with HA turned on. only one LAN can be set as the ha_link.`}).option(`is-breakout`,{type:`boolean`,description:`mark true to use this LAN for source-based breakout traffic`}).option(`is-prioritized`,{type:`boolean`,description:`mark true to use this LAN for source-based prioritized traffic`}).option(`name`,{type:`string`,description:`The name field`}).option(`nat-static-prefix`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`physport`,{type:`number`,description:`The physport field`}).option(`static-addressing-address`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`static-addressing-dhcp-relay-server-addresses`,{type:`string`,array:!0,description:`List of DHCP server IPs.`}).option(`static-addressing-dhcp-server-dhcp-pool-end`,{type:`string`,description:`A valid IPv4 address.`}).option(`static-addressing-dhcp-server-dhcp-pool-start`,{type:`string`,description:`A valid IPv4 address.`}).option(`static-addressing-dhcp-server-dns-server`,{type:`string`,description:`A valid IPv4 address.`}).option(`static-addressing-dhcp-server-dns-servers`,{type:`string`,array:!0,description:`The static_addressing.dhcp_server.dns_servers field`}).option(`static-addressing-secondary-address`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`static-addressing-virtual-address`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`vlan-tag`,{type:`number`,description:`VLAN ID. Use zero for untagged.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`static-addressing-address`,`static-addressing-dhcp-relay-server-addresses`,`static-addressing-dhcp-server-dhcp-pool-end`,`static-addressing-dhcp-server-dhcp-pool-start`,`static-addressing-dhcp-server-dns-server`,`static-addressing-dhcp-server-dns-servers`,`static-addressing-secondary-address`,`static-addressing-virtual-address`].some(t=>e[t]!==void 0)){let t=[`static-addressing-address`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --static_addressing-* flag is set`)}return!0})}const Si={command:`create <siteId>`,describe:`Creates a new Site LAN. If the site is in high availability mode, static_addressing is required along with secondary and virtual address.`,builder:xi,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit sites lans create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${t.siteId??`<siteId>`}/lans`,pathParams:{siteId:String(t.siteId??``)},bodyKind:`json`,body:{bondId:t.bondId,haLink:t.haLink,isBreakout:t.isBreakout,isPrioritized:t.isPrioritized,name:t.name,natStaticPrefix:t.natStaticPrefix,physport:t.physport,staticAddressingAddress:t.staticAddressingAddress,staticAddressingDhcpRelayServerAddresses:t.staticAddressingDhcpRelayServerAddresses,staticAddressingDhcpServerDhcpPoolEnd:t.staticAddressingDhcpServerDhcpPoolEnd,staticAddressingDhcpServerDhcpPoolStart:t.staticAddressingDhcpServerDhcpPoolStart,staticAddressingDhcpServerDnsServer:t.staticAddressingDhcpServerDnsServer,staticAddressingDhcpServerDnsServers:t.staticAddressingDhcpServerDnsServers,staticAddressingSecondaryAddress:t.staticAddressingSecondaryAddress,staticAddressingVirtualAddress:t.staticAddressingVirtualAddress,vlanTag:t.vlanTag,body:t.body}});return}let n=await r(t),f=t.local?d:await e(n);if(t.accountId=f,t.body){let e=o(t.body);s(await l(`Creating`,async()=>n.post(`/accounts/${f}/magic/sites/${t.siteId}/lans`,{body:e})),{successLabel:`Created`});return}let p={};t.bondId!==void 0&&a(p,[`bond_id`],t.bondId),t.haLink!==void 0&&a(p,[`ha_link`],t.haLink),t.isBreakout!==void 0&&a(p,[`is_breakout`],t.isBreakout),t.isPrioritized!==void 0&&a(p,[`is_prioritized`],t.isPrioritized),t.name!==void 0&&a(p,[`name`],u(t.name,`name`,`text`)),t.natStaticPrefix!==void 0&&a(p,[`nat`,`static_prefix`],u(t.natStaticPrefix,`natStaticPrefix`,`text`)),t.physport!==void 0&&a(p,[`physport`],t.physport),t.staticAddressingAddress!==void 0&&a(p,[`static_addressing`,`address`],u(t.staticAddressingAddress,`staticAddressingAddress`,`text`)),t.staticAddressingDhcpRelayServerAddresses!==void 0&&a(p,[`static_addressing`,`dhcp_relay`,`server_addresses`],t.staticAddressingDhcpRelayServerAddresses),t.staticAddressingDhcpServerDhcpPoolEnd!==void 0&&a(p,[`static_addressing`,`dhcp_server`,`dhcp_pool_end`],u(t.staticAddressingDhcpServerDhcpPoolEnd,`staticAddressingDhcpServerDhcpPoolEnd`,`text`)),t.staticAddressingDhcpServerDhcpPoolStart!==void 0&&a(p,[`static_addressing`,`dhcp_server`,`dhcp_pool_start`],u(t.staticAddressingDhcpServerDhcpPoolStart,`staticAddressingDhcpServerDhcpPoolStart`,`text`)),t.staticAddressingDhcpServerDnsServer!==void 0&&a(p,[`static_addressing`,`dhcp_server`,`dns_server`],u(t.staticAddressingDhcpServerDnsServer,`staticAddressingDhcpServerDnsServer`,`text`)),t.staticAddressingDhcpServerDnsServers!==void 0&&a(p,[`static_addressing`,`dhcp_server`,`dns_servers`],t.staticAddressingDhcpServerDnsServers),t.staticAddressingSecondaryAddress!==void 0&&a(p,[`static_addressing`,`secondary_address`],u(t.staticAddressingSecondaryAddress,`staticAddressingSecondaryAddress`,`text`)),t.staticAddressingVirtualAddress!==void 0&&a(p,[`static_addressing`,`virtual_address`],u(t.staticAddressingVirtualAddress,`staticAddressingVirtualAddress`,`text`)),t.vlanTag!==void 0&&a(p,[`vlan_tag`],t.vlanTag),s(await l(`Creating`,async()=>n.post(`/accounts/${f}/magic/sites/${t.siteId}/lans`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`})}};function Ci(e){return e.positional(`lanId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const wi={command:`delete <lanId>`,describe:`Remove a specific Site LAN.`,builder:Ci,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites lans delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${n.siteId??`<siteId>`}/lans/${n.lanId??`<lanId>`}`,pathParams:{siteId:String(n.siteId??``),lanId:String(n.lanId??``)},bodyKind:`json`,body:{body:n.body}});return}let a=await r(n),u=n.local?d:await e(a);if(n.accountId=u,!await t({force:!!n.force})){process.stderr.write(`Aborted.
|
|
87
|
-
`);return}if(n.body){let e=o(n.body);s(await l(`Deleting`,async()=>a.delete(`/accounts/${u}/magic/sites/${n.siteId}/lans/${n.lanId}`,{body:e})),{successLabel:`Deleted`});return}s(await l(`Deleting`,async()=>a.magicTransit.sites.lans.delete(n.siteId,u,n.lanId)),{successLabel:`Deleted`})}};function Ti(e){return e.positional(`lanId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`bond-id`,{type:`number`,description:`The bond_id field`}).option(`is-breakout`,{type:`boolean`,description:`mark true to use this LAN for source-based breakout traffic`}).option(`is-prioritized`,{type:`boolean`,description:`mark true to use this LAN for source-based prioritized traffic`}).option(`name`,{type:`string`,description:`The name field`}).option(`nat-static-prefix`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`physport`,{type:`number`,description:`The physport field`}).option(`static-addressing-address`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`static-addressing-dhcp-relay-server-addresses`,{type:`string`,array:!0,description:`List of DHCP server IPs.`}).option(`static-addressing-dhcp-server-dhcp-pool-end`,{type:`string`,description:`A valid IPv4 address.`}).option(`static-addressing-dhcp-server-dhcp-pool-start`,{type:`string`,description:`A valid IPv4 address.`}).option(`static-addressing-dhcp-server-dns-server`,{type:`string`,description:`A valid IPv4 address.`}).option(`static-addressing-dhcp-server-dns-servers`,{type:`string`,array:!0,description:`The static_addressing.dhcp_server.dns_servers field`}).option(`static-addressing-secondary-address`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`static-addressing-virtual-address`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`vlan-tag`,{type:`number`,description:`VLAN ID. Use zero for untagged.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`static-addressing-address`,`static-addressing-dhcp-relay-server-addresses`,`static-addressing-dhcp-server-dhcp-pool-end`,`static-addressing-dhcp-server-dhcp-pool-start`,`static-addressing-dhcp-server-dns-server`,`static-addressing-dhcp-server-dns-servers`,`static-addressing-secondary-address`,`static-addressing-virtual-address`].some(t=>e[t]!==void 0)){let t=[`static-addressing-address`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --static_addressing-* flag is set`)}return!0})}const Ei={command:`edit <lanId>`,describe:`Patch a specific Site LAN.`,builder:Ti,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit sites lans edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${t.siteId??`<siteId>`}/lans/${t.lanId??`<lanId>`}`,pathParams:{siteId:String(t.siteId??``),lanId:String(t.lanId??``)},bodyKind:`json`,body:{bondId:t.bondId,isBreakout:t.isBreakout,isPrioritized:t.isPrioritized,name:t.name,natStaticPrefix:t.natStaticPrefix,physport:t.physport,staticAddressingAddress:t.staticAddressingAddress,staticAddressingDhcpRelayServerAddresses:t.staticAddressingDhcpRelayServerAddresses,staticAddressingDhcpServerDhcpPoolEnd:t.staticAddressingDhcpServerDhcpPoolEnd,staticAddressingDhcpServerDhcpPoolStart:t.staticAddressingDhcpServerDhcpPoolStart,staticAddressingDhcpServerDnsServer:t.staticAddressingDhcpServerDnsServer,staticAddressingDhcpServerDnsServers:t.staticAddressingDhcpServerDnsServers,staticAddressingSecondaryAddress:t.staticAddressingSecondaryAddress,staticAddressingVirtualAddress:t.staticAddressingVirtualAddress,vlanTag:t.vlanTag,body:t.body}});return}let n=await r(t),f=t.local?d:await e(n);if(t.accountId=f,t.body){let e=o(t.body);s(await l(`Updating`,async()=>n.patch(`/accounts/${f}/magic/sites/${t.siteId}/lans/${t.lanId}`,{body:e})),{successLabel:`Updated`});return}let p={};t.bondId!==void 0&&a(p,[`bond_id`],t.bondId),t.isBreakout!==void 0&&a(p,[`is_breakout`],t.isBreakout),t.isPrioritized!==void 0&&a(p,[`is_prioritized`],t.isPrioritized),t.name!==void 0&&a(p,[`name`],u(t.name,`name`,`text`)),t.natStaticPrefix!==void 0&&a(p,[`nat`,`static_prefix`],u(t.natStaticPrefix,`natStaticPrefix`,`text`)),t.physport!==void 0&&a(p,[`physport`],t.physport),t.staticAddressingAddress!==void 0&&a(p,[`static_addressing`,`address`],u(t.staticAddressingAddress,`staticAddressingAddress`,`text`)),t.staticAddressingDhcpRelayServerAddresses!==void 0&&a(p,[`static_addressing`,`dhcp_relay`,`server_addresses`],t.staticAddressingDhcpRelayServerAddresses),t.staticAddressingDhcpServerDhcpPoolEnd!==void 0&&a(p,[`static_addressing`,`dhcp_server`,`dhcp_pool_end`],u(t.staticAddressingDhcpServerDhcpPoolEnd,`staticAddressingDhcpServerDhcpPoolEnd`,`text`)),t.staticAddressingDhcpServerDhcpPoolStart!==void 0&&a(p,[`static_addressing`,`dhcp_server`,`dhcp_pool_start`],u(t.staticAddressingDhcpServerDhcpPoolStart,`staticAddressingDhcpServerDhcpPoolStart`,`text`)),t.staticAddressingDhcpServerDnsServer!==void 0&&a(p,[`static_addressing`,`dhcp_server`,`dns_server`],u(t.staticAddressingDhcpServerDnsServer,`staticAddressingDhcpServerDnsServer`,`text`)),t.staticAddressingDhcpServerDnsServers!==void 0&&a(p,[`static_addressing`,`dhcp_server`,`dns_servers`],t.staticAddressingDhcpServerDnsServers),t.staticAddressingSecondaryAddress!==void 0&&a(p,[`static_addressing`,`secondary_address`],u(t.staticAddressingSecondaryAddress,`staticAddressingSecondaryAddress`,`text`)),t.staticAddressingVirtualAddress!==void 0&&a(p,[`static_addressing`,`virtual_address`],u(t.staticAddressingVirtualAddress,`staticAddressingVirtualAddress`,`text`)),t.vlanTag!==void 0&&a(p,[`vlan_tag`],t.vlanTag),s(await l(`Updating`,async()=>n.patch(`/accounts/${f}/magic/sites/${t.siteId}/lans/${t.lanId}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}};function Di(e){return e.positional(`lanId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Oi={command:`get <lanId>`,describe:`Get a specific Site LAN.`,builder:Di,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit sites lans get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${t.siteId??`<siteId>`}/lans/${t.lanId??`<lanId>`}`,pathParams:{siteId:String(t.siteId??``),lanId:String(t.lanId??``)},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.magicTransit.sites.lans.get(t.siteId,a,t.lanId)),{successLabel:`Loaded`})}};function ki(e){return e.option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ai={command:`list`,describe:`Lists Site LANs associated with an account.`,builder:ki,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit sites lans list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${t.siteId??`<siteId>`}/lans`,pathParams:{siteId:String(t.siteId??``)},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.magicTransit.sites.lans.list(a,t.siteId)),{successLabel:`Loaded`})}};function ji(e){return e.positional(`lanId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`bond-id`,{type:`number`,description:`The bond_id field`}).option(`is-breakout`,{type:`boolean`,description:`mark true to use this LAN for source-based breakout traffic`}).option(`is-prioritized`,{type:`boolean`,description:`mark true to use this LAN for source-based prioritized traffic`}).option(`name`,{type:`string`,description:`The name field`}).option(`nat-static-prefix`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`physport`,{type:`number`,description:`The physport field`}).option(`static-addressing-address`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`static-addressing-dhcp-relay-server-addresses`,{type:`string`,array:!0,description:`List of DHCP server IPs.`}).option(`static-addressing-dhcp-server-dhcp-pool-end`,{type:`string`,description:`A valid IPv4 address.`}).option(`static-addressing-dhcp-server-dhcp-pool-start`,{type:`string`,description:`A valid IPv4 address.`}).option(`static-addressing-dhcp-server-dns-server`,{type:`string`,description:`A valid IPv4 address.`}).option(`static-addressing-dhcp-server-dns-servers`,{type:`string`,array:!0,description:`The static_addressing.dhcp_server.dns_servers field`}).option(`static-addressing-secondary-address`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`static-addressing-virtual-address`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`vlan-tag`,{type:`number`,description:`VLAN ID. Use zero for untagged.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`static-addressing-address`,`static-addressing-dhcp-relay-server-addresses`,`static-addressing-dhcp-server-dhcp-pool-end`,`static-addressing-dhcp-server-dhcp-pool-start`,`static-addressing-dhcp-server-dns-server`,`static-addressing-dhcp-server-dns-servers`,`static-addressing-secondary-address`,`static-addressing-virtual-address`].some(t=>e[t]!==void 0)){let t=[`static-addressing-address`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --static_addressing-* flag is set`)}return!0})}const Mi={command:`update <lanId>`,describe:`Update a specific Site LAN.`,builder:ji,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit sites lans update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${t.siteId??`<siteId>`}/lans/${t.lanId??`<lanId>`}`,pathParams:{siteId:String(t.siteId??``),lanId:String(t.lanId??``)},bodyKind:`json`,body:{bondId:t.bondId,isBreakout:t.isBreakout,isPrioritized:t.isPrioritized,name:t.name,natStaticPrefix:t.natStaticPrefix,physport:t.physport,staticAddressingAddress:t.staticAddressingAddress,staticAddressingDhcpRelayServerAddresses:t.staticAddressingDhcpRelayServerAddresses,staticAddressingDhcpServerDhcpPoolEnd:t.staticAddressingDhcpServerDhcpPoolEnd,staticAddressingDhcpServerDhcpPoolStart:t.staticAddressingDhcpServerDhcpPoolStart,staticAddressingDhcpServerDnsServer:t.staticAddressingDhcpServerDnsServer,staticAddressingDhcpServerDnsServers:t.staticAddressingDhcpServerDnsServers,staticAddressingSecondaryAddress:t.staticAddressingSecondaryAddress,staticAddressingVirtualAddress:t.staticAddressingVirtualAddress,vlanTag:t.vlanTag,body:t.body}});return}let n=await r(t),f=t.local?d:await e(n);if(t.accountId=f,t.body){let e=o(t.body);s(await l(`Updating`,async()=>n.put(`/accounts/${f}/magic/sites/${t.siteId}/lans/${t.lanId}`,{body:e})),{successLabel:`Updated`});return}let p={};t.bondId!==void 0&&a(p,[`bond_id`],t.bondId),t.isBreakout!==void 0&&a(p,[`is_breakout`],t.isBreakout),t.isPrioritized!==void 0&&a(p,[`is_prioritized`],t.isPrioritized),t.name!==void 0&&a(p,[`name`],u(t.name,`name`,`text`)),t.natStaticPrefix!==void 0&&a(p,[`nat`,`static_prefix`],u(t.natStaticPrefix,`natStaticPrefix`,`text`)),t.physport!==void 0&&a(p,[`physport`],t.physport),t.staticAddressingAddress!==void 0&&a(p,[`static_addressing`,`address`],u(t.staticAddressingAddress,`staticAddressingAddress`,`text`)),t.staticAddressingDhcpRelayServerAddresses!==void 0&&a(p,[`static_addressing`,`dhcp_relay`,`server_addresses`],t.staticAddressingDhcpRelayServerAddresses),t.staticAddressingDhcpServerDhcpPoolEnd!==void 0&&a(p,[`static_addressing`,`dhcp_server`,`dhcp_pool_end`],u(t.staticAddressingDhcpServerDhcpPoolEnd,`staticAddressingDhcpServerDhcpPoolEnd`,`text`)),t.staticAddressingDhcpServerDhcpPoolStart!==void 0&&a(p,[`static_addressing`,`dhcp_server`,`dhcp_pool_start`],u(t.staticAddressingDhcpServerDhcpPoolStart,`staticAddressingDhcpServerDhcpPoolStart`,`text`)),t.staticAddressingDhcpServerDnsServer!==void 0&&a(p,[`static_addressing`,`dhcp_server`,`dns_server`],u(t.staticAddressingDhcpServerDnsServer,`staticAddressingDhcpServerDnsServer`,`text`)),t.staticAddressingDhcpServerDnsServers!==void 0&&a(p,[`static_addressing`,`dhcp_server`,`dns_servers`],t.staticAddressingDhcpServerDnsServers),t.staticAddressingSecondaryAddress!==void 0&&a(p,[`static_addressing`,`secondary_address`],u(t.staticAddressingSecondaryAddress,`staticAddressingSecondaryAddress`,`text`)),t.staticAddressingVirtualAddress!==void 0&&a(p,[`static_addressing`,`virtual_address`],u(t.staticAddressingVirtualAddress,`staticAddressingVirtualAddress`,`text`)),t.vlanTag!==void 0&&a(p,[`vlan_tag`],t.vlanTag),s(await l(`Updating`,async()=>n.put(`/accounts/${f}/magic/sites/${t.siteId}/lans/${t.lanId}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}},Ni={command:`lans`,describe:`Magic WAN branch sites with LAN/WAN interface configuration and connector assignments`,builder:e=>e.command(Si).command(wi).command(Ei).command(Oi).command(Ai).command(Mi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Pi(e){return e.option(`connectorid`,{type:`string`,description:`Identifier`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Fi={command:`list`,describe:`Lists Sites associated with an account. Use connectorid query param to return sites where connectorid matches either site.ConnectorID or site.SecondaryConnectorID.`,builder:Pi,handler:async t=>{let n={connectorid:t.connectorid};if(t.dryRun){c({command:`cf magic-transit sites list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites`,pathParams:{},query:n,bodyKind:`none`});return}let a=await r(t),o=t.local?d:await e(a);t.accountId=o,s(await l(`Loading`,async()=>a.magicTransit.sites.list(o,n)),{successLabel:`Loaded`})}};function Ii(e){return e.positional(`siteId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`active-timeout`,{type:`number`,description:`Timeout in seconds for active flows.`}).option(`collector-ip`,{type:`string`,description:`IPv4 address of the NetFlow collector.`}).option(`collector-port`,{type:`number`,description:`UDP port of the NetFlow collector.`}).option(`inactive-timeout`,{type:`number`,description:`Timeout in seconds for inactive flows.`}).option(`sampling-rate`,{type:`number`,description:`Sampling rate for NetFlow records (1 = every packet).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Li={command:`create <siteId>`,describe:`Creates a NetFlow configuration for a site.`,builder:Ii,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit sites netflow-config create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${t.siteId??`<siteId>`}/netflow_config`,pathParams:{siteId:String(t.siteId??``)},bodyKind:`json`,body:{activeTimeout:t.activeTimeout,collectorIp:t.collectorIp,collectorPort:t.collectorPort,inactiveTimeout:t.inactiveTimeout,samplingRate:t.samplingRate,body:t.body}});return}let n=await r(t),f=t.local?d:await e(n);if(t.accountId=f,t.body){let e=o(t.body);s(await l(`Creating`,async()=>n.post(`/accounts/${f}/magic/sites/${t.siteId}/netflow_config`,{body:e})),{successLabel:`Created`});return}let p={};t.activeTimeout!==void 0&&a(p,[`active_timeout`],t.activeTimeout),t.collectorIp!==void 0&&a(p,[`collector_ip`],u(t.collectorIp,`collectorIp`,`text`)),t.collectorPort!==void 0&&a(p,[`collector_port`],t.collectorPort),t.inactiveTimeout!==void 0&&a(p,[`inactive_timeout`],t.inactiveTimeout),t.samplingRate!==void 0&&a(p,[`sampling_rate`],t.samplingRate),s(await l(`Creating`,async()=>n.post(`/accounts/${f}/magic/sites/${t.siteId}/netflow_config`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`})}};function Ri(e){return e.positional(`siteId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const zi={command:`delete <siteId>`,describe:`Remove NetFlow configuration for a site.`,builder:Ri,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites netflow-config delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${n.siteId??`<siteId>`}/netflow_config`,pathParams:{siteId:String(n.siteId??``)},bodyKind:`json`,body:{body:n.body}});return}let a=await r(n),u=n.local?d:await e(a);if(n.accountId=u,!await t({force:!!n.force})){process.stderr.write(`Aborted.
|
|
88
|
-
`);return}if(n.body){let e=o(n.body);s(await l(`Deleting`,async()=>a.delete(`/accounts/${u}/magic/sites/${n.siteId}/netflow_config`,{body:e})),{successLabel:`Deleted`});return}s(await l(`Deleting`,async()=>a.magicTransit.sites.netflowConfig.delete(u,n.siteId)),{successLabel:`Deleted`})}};function Bi(e){return e.positional(`siteId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`active-timeout`,{type:`number`,description:`Timeout in seconds for active flows.`}).option(`collector-ip`,{type:`string`,description:`IPv4 address of the NetFlow collector.`}).option(`collector-port`,{type:`number`,description:`UDP port of the NetFlow collector.`}).option(`inactive-timeout`,{type:`number`,description:`Timeout in seconds for inactive flows.`}).option(`sampling-rate`,{type:`number`,description:`Sampling rate for NetFlow records (1 = every packet).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Vi={command:`edit <siteId>`,describe:`Updates NetFlow configuration for a site.`,builder:Bi,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit sites netflow-config edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${t.siteId??`<siteId>`}/netflow_config`,pathParams:{siteId:String(t.siteId??``)},bodyKind:`json`,body:{activeTimeout:t.activeTimeout,collectorIp:t.collectorIp,collectorPort:t.collectorPort,inactiveTimeout:t.inactiveTimeout,samplingRate:t.samplingRate,body:t.body}});return}let n=await r(t),f=t.local?d:await e(n);if(t.accountId=f,t.body){let e=o(t.body);s(await l(`Updating`,async()=>n.patch(`/accounts/${f}/magic/sites/${t.siteId}/netflow_config`,{body:e})),{successLabel:`Updated`});return}let p={};t.activeTimeout!==void 0&&a(p,[`active_timeout`],t.activeTimeout),t.collectorIp!==void 0&&a(p,[`collector_ip`],u(t.collectorIp,`collectorIp`,`text`)),t.collectorPort!==void 0&&a(p,[`collector_port`],t.collectorPort),t.inactiveTimeout!==void 0&&a(p,[`inactive_timeout`],t.inactiveTimeout),t.samplingRate!==void 0&&a(p,[`sampling_rate`],t.samplingRate),s(await l(`Updating`,async()=>n.patch(`/accounts/${f}/magic/sites/${t.siteId}/netflow_config`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}};function Hi(e){return e.positional(`siteId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ui={command:`get <siteId>`,describe:`Get NetFlow configuration for a site.`,builder:Hi,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit sites netflow-config get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${t.siteId??`<siteId>`}/netflow_config`,pathParams:{siteId:String(t.siteId??``)},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.magicTransit.sites.netflowConfig.get(a,t.siteId)),{successLabel:`Loaded`})}};function Wi(e){return e.positional(`siteId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`active-timeout`,{type:`number`,description:`Timeout in seconds for active flows.`}).option(`collector-ip`,{type:`string`,description:`IPv4 address of the NetFlow collector.`}).option(`collector-port`,{type:`number`,description:`UDP port of the NetFlow collector.`}).option(`inactive-timeout`,{type:`number`,description:`Timeout in seconds for inactive flows.`}).option(`sampling-rate`,{type:`number`,description:`Sampling rate for NetFlow records (1 = every packet).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Gi={command:`update <siteId>`,describe:`Updates NetFlow configuration for a site (partial update).`,builder:Wi,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit sites netflow-config update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${t.siteId??`<siteId>`}/netflow_config`,pathParams:{siteId:String(t.siteId??``)},bodyKind:`json`,body:{activeTimeout:t.activeTimeout,collectorIp:t.collectorIp,collectorPort:t.collectorPort,inactiveTimeout:t.inactiveTimeout,samplingRate:t.samplingRate,body:t.body}});return}let n=await r(t),f=t.local?d:await e(n);if(t.accountId=f,t.body){let e=o(t.body);s(await l(`Updating`,async()=>n.put(`/accounts/${f}/magic/sites/${t.siteId}/netflow_config`,{body:e})),{successLabel:`Updated`});return}let p={};t.activeTimeout!==void 0&&a(p,[`active_timeout`],t.activeTimeout),t.collectorIp!==void 0&&a(p,[`collector_ip`],u(t.collectorIp,`collectorIp`,`text`)),t.collectorPort!==void 0&&a(p,[`collector_port`],t.collectorPort),t.inactiveTimeout!==void 0&&a(p,[`inactive_timeout`],t.inactiveTimeout),t.samplingRate!==void 0&&a(p,[`sampling_rate`],t.samplingRate),s(await l(`Updating`,async()=>n.put(`/accounts/${f}/magic/sites/${t.siteId}/netflow_config`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}},Ki={command:`netflow-config`,describe:`Magic WAN site app configuration and NetFlow config management`,builder:e=>e.command(Li).command(zi).command(Vi).command(Ui).command(Gi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function qi(e){return e.positional(`siteId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`connector-id`,{type:`string`,description:`Magic Connector identifier tag.`}).option(`description`,{type:`string`,description:`The description field`}).option(`location-lat`,{type:`string`,description:`Latitude`}).option(`location-lon`,{type:`string`,description:`Longitude`}).option(`name`,{type:`string`,description:`The name of the site.`}).option(`secondary-connector-id`,{type:`string`,description:`Magic Connector identifier tag. Used when high availability mode is on.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ji={command:`update <siteId>`,describe:`Update a specific Site.`,builder:qi,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit sites update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${t.siteId??`<siteId>`}`,pathParams:{siteId:String(t.siteId??``)},bodyKind:`json`,body:{connectorId:t.connectorId,description:t.description,locationLat:t.locationLat,locationLon:t.locationLon,name:t.name,secondaryConnectorId:t.secondaryConnectorId,body:t.body}});return}let n=await r(t),f=t.local?d:await e(n);if(t.accountId=f,t.body){let e=o(t.body);s(await l(`Updating`,async()=>n.put(`/accounts/${f}/magic/sites/${t.siteId}`,{body:e})),{successLabel:`Updated`});return}let p={};t.connectorId!==void 0&&a(p,[`connector_id`],u(t.connectorId,`connectorId`,`text`)),t.description!==void 0&&a(p,[`description`],u(t.description,`description`,`text`)),t.locationLat!==void 0&&a(p,[`location`,`lat`],u(t.locationLat,`locationLat`,`text`)),t.locationLon!==void 0&&a(p,[`location`,`lon`],u(t.locationLon,`locationLon`,`text`)),t.name!==void 0&&a(p,[`name`],u(t.name,`name`,`text`)),t.secondaryConnectorId!==void 0&&a(p,[`secondary_connector_id`],u(t.secondaryConnectorId,`secondaryConnectorId`,`text`)),s(await l(`Updating`,async()=>n.put(`/accounts/${f}/magic/sites/${t.siteId}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}};function Yi(e){return e.positional(`siteId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`name`,{type:`string`,description:`The name field`}).option(`physport`,{type:`number`,description:`The physport field`}).option(`priority`,{type:`number`,description:`The priority field`}).option(`static-addressing-address`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`static-addressing-gateway-address`,{type:`string`,description:`A valid IPv4 address.`}).option(`static-addressing-secondary-address`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`vlan-tag`,{type:`number`,description:`VLAN ID. Use zero for untagged.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`static-addressing-address`,`static-addressing-gateway-address`,`static-addressing-secondary-address`].some(t=>e[t]!==void 0)){let t=[`static-addressing-address`,`static-addressing-gateway-address`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --static_addressing-* flag is set`)}return!0})}const Xi={command:`create <siteId>`,describe:`Creates a new Site WAN.`,builder:Yi,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit sites wans create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${t.siteId??`<siteId>`}/wans`,pathParams:{siteId:String(t.siteId??``)},bodyKind:`json`,body:{name:t.name,physport:t.physport,priority:t.priority,staticAddressingAddress:t.staticAddressingAddress,staticAddressingGatewayAddress:t.staticAddressingGatewayAddress,staticAddressingSecondaryAddress:t.staticAddressingSecondaryAddress,vlanTag:t.vlanTag,body:t.body}});return}let n=await r(t),f=t.local?d:await e(n);if(t.accountId=f,t.body){let e=o(t.body);s(await l(`Creating`,async()=>n.post(`/accounts/${f}/magic/sites/${t.siteId}/wans`,{body:e})),{successLabel:`Created`});return}if(t.physport===void 0)throw Error(`--physport is required (or pass --body with this field set).`);let p={};t.name!==void 0&&a(p,[`name`],u(t.name,`name`,`text`)),t.physport!==void 0&&a(p,[`physport`],t.physport),t.priority!==void 0&&a(p,[`priority`],t.priority),t.staticAddressingAddress!==void 0&&a(p,[`static_addressing`,`address`],u(t.staticAddressingAddress,`staticAddressingAddress`,`text`)),t.staticAddressingGatewayAddress!==void 0&&a(p,[`static_addressing`,`gateway_address`],u(t.staticAddressingGatewayAddress,`staticAddressingGatewayAddress`,`text`)),t.staticAddressingSecondaryAddress!==void 0&&a(p,[`static_addressing`,`secondary_address`],u(t.staticAddressingSecondaryAddress,`staticAddressingSecondaryAddress`,`text`)),t.vlanTag!==void 0&&a(p,[`vlan_tag`],t.vlanTag),s(await l(`Creating`,async()=>n.post(`/accounts/${f}/magic/sites/${t.siteId}/wans`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`})}};function Zi(e){return e.positional(`wanId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Qi={command:`delete <wanId>`,describe:`Remove a specific Site WAN.`,builder:Zi,handler:async n=>{if(n.dryRun){c({command:`cf magic-transit sites wans delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${n.siteId??`<siteId>`}/wans/${n.wanId??`<wanId>`}`,pathParams:{siteId:String(n.siteId??``),wanId:String(n.wanId??``)},bodyKind:`json`,body:{body:n.body}});return}let a=await r(n),u=n.local?d:await e(a);if(n.accountId=u,!await t({force:!!n.force})){process.stderr.write(`Aborted.
|
|
89
|
-
`);return}if(n.body){let e=o(n.body);s(await l(`Deleting`,async()=>a.delete(`/accounts/${u}/magic/sites/${n.siteId}/wans/${n.wanId}`,{body:e})),{successLabel:`Deleted`});return}s(await l(`Deleting`,async()=>a.magicTransit.sites.wans.delete(n.siteId,u,n.wanId)),{successLabel:`Deleted`})}};function $i(e){return e.positional(`wanId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`name`,{type:`string`,description:`The name field`}).option(`physport`,{type:`number`,description:`The physport field`}).option(`priority`,{type:`number`,description:`The priority field`}).option(`static-addressing-address`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`static-addressing-gateway-address`,{type:`string`,description:`A valid IPv4 address.`}).option(`static-addressing-secondary-address`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`vlan-tag`,{type:`number`,description:`VLAN ID. Use zero for untagged.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`static-addressing-address`,`static-addressing-gateway-address`,`static-addressing-secondary-address`].some(t=>e[t]!==void 0)){let t=[`static-addressing-address`,`static-addressing-gateway-address`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --static_addressing-* flag is set`)}return!0})}const ea={command:`edit <wanId>`,describe:`Patch a specific Site WAN.`,builder:$i,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit sites wans edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${t.siteId??`<siteId>`}/wans/${t.wanId??`<wanId>`}`,pathParams:{siteId:String(t.siteId??``),wanId:String(t.wanId??``)},bodyKind:`json`,body:{name:t.name,physport:t.physport,priority:t.priority,staticAddressingAddress:t.staticAddressingAddress,staticAddressingGatewayAddress:t.staticAddressingGatewayAddress,staticAddressingSecondaryAddress:t.staticAddressingSecondaryAddress,vlanTag:t.vlanTag,body:t.body}});return}let n=await r(t),f=t.local?d:await e(n);if(t.accountId=f,t.body){let e=o(t.body);s(await l(`Updating`,async()=>n.patch(`/accounts/${f}/magic/sites/${t.siteId}/wans/${t.wanId}`,{body:e})),{successLabel:`Updated`});return}let p={};t.name!==void 0&&a(p,[`name`],u(t.name,`name`,`text`)),t.physport!==void 0&&a(p,[`physport`],t.physport),t.priority!==void 0&&a(p,[`priority`],t.priority),t.staticAddressingAddress!==void 0&&a(p,[`static_addressing`,`address`],u(t.staticAddressingAddress,`staticAddressingAddress`,`text`)),t.staticAddressingGatewayAddress!==void 0&&a(p,[`static_addressing`,`gateway_address`],u(t.staticAddressingGatewayAddress,`staticAddressingGatewayAddress`,`text`)),t.staticAddressingSecondaryAddress!==void 0&&a(p,[`static_addressing`,`secondary_address`],u(t.staticAddressingSecondaryAddress,`staticAddressingSecondaryAddress`,`text`)),t.vlanTag!==void 0&&a(p,[`vlan_tag`],t.vlanTag),s(await l(`Updating`,async()=>n.patch(`/accounts/${f}/magic/sites/${t.siteId}/wans/${t.wanId}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}};function ta(e){return e.positional(`wanId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const na={command:`get <wanId>`,describe:`Get a specific Site WAN.`,builder:ta,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit sites wans get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${t.siteId??`<siteId>`}/wans/${t.wanId??`<wanId>`}`,pathParams:{siteId:String(t.siteId??``),wanId:String(t.wanId??``)},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.magicTransit.sites.wans.get(t.siteId,a,t.wanId)),{successLabel:`Loaded`})}};function ra(e){return e.option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ia={command:`list`,describe:`Lists Site WANs associated with an account.`,builder:ra,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit sites wans list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${t.siteId??`<siteId>`}/wans`,pathParams:{siteId:String(t.siteId??``)},bodyKind:`none`});return}let n=await r(t),a=t.local?d:await e(n);t.accountId=a,s(await l(`Loading`,async()=>n.magicTransit.sites.wans.list(a,t.siteId)),{successLabel:`Loaded`})}};function aa(e){return e.positional(`wanId`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`site-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`name`,{type:`string`,description:`The name field`}).option(`physport`,{type:`number`,description:`The physport field`}).option(`priority`,{type:`number`,description:`The priority field`}).option(`static-addressing-address`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`static-addressing-gateway-address`,{type:`string`,description:`A valid IPv4 address.`}).option(`static-addressing-secondary-address`,{type:`string`,description:`A valid CIDR notation representing an IP range.`}).option(`vlan-tag`,{type:`number`,description:`VLAN ID. Use zero for untagged.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`static-addressing-address`,`static-addressing-gateway-address`,`static-addressing-secondary-address`].some(t=>e[t]!==void 0)){let t=[`static-addressing-address`,`static-addressing-gateway-address`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --static_addressing-* flag is set`)}return!0})}const oa={command:`update <wanId>`,describe:`Update a specific Site WAN.`,builder:aa,handler:async t=>{if(t.dryRun){c({command:`cf magic-transit sites wans update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${i()??`<account-id>`}/magic/sites/${t.siteId??`<siteId>`}/wans/${t.wanId??`<wanId>`}`,pathParams:{siteId:String(t.siteId??``),wanId:String(t.wanId??``)},bodyKind:`json`,body:{name:t.name,physport:t.physport,priority:t.priority,staticAddressingAddress:t.staticAddressingAddress,staticAddressingGatewayAddress:t.staticAddressingGatewayAddress,staticAddressingSecondaryAddress:t.staticAddressingSecondaryAddress,vlanTag:t.vlanTag,body:t.body}});return}let n=await r(t),f=t.local?d:await e(n);if(t.accountId=f,t.body){let e=o(t.body);s(await l(`Updating`,async()=>n.put(`/accounts/${f}/magic/sites/${t.siteId}/wans/${t.wanId}`,{body:e})),{successLabel:`Updated`});return}let p={};t.name!==void 0&&a(p,[`name`],u(t.name,`name`,`text`)),t.physport!==void 0&&a(p,[`physport`],t.physport),t.priority!==void 0&&a(p,[`priority`],t.priority),t.staticAddressingAddress!==void 0&&a(p,[`static_addressing`,`address`],u(t.staticAddressingAddress,`staticAddressingAddress`,`text`)),t.staticAddressingGatewayAddress!==void 0&&a(p,[`static_addressing`,`gateway_address`],u(t.staticAddressingGatewayAddress,`staticAddressingGatewayAddress`,`text`)),t.staticAddressingSecondaryAddress!==void 0&&a(p,[`static_addressing`,`secondary_address`],u(t.staticAddressingSecondaryAddress,`staticAddressingSecondaryAddress`,`text`)),t.vlanTag!==void 0&&a(p,[`vlan_tag`],t.vlanTag),s(await l(`Updating`,async()=>n.put(`/accounts/${f}/magic/sites/${t.siteId}/wans/${t.wanId}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}},sa={command:`wans`,describe:`Magic WAN branch sites with LAN/WAN interface configuration and connector assignments`,builder:e=>e.command(Xi).command(Qi).command(ea).command(na).command(ia).command(oa).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ca={command:`sites`,describe:`Magic WAN branch sites with LAN/WAN interface configuration and connector assignments`,builder:e=>e.command(mi).command(gi).command(vi).command(bi).command(Fi).command(Ji).command(ti).command(fi).command(Ni).command(Ki).command(sa).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},la={command:`magic-transit`,describe:`DDoS-protected network transit — GRE/IPsec tunnels, static routes, Magic WAN sites, connectors, and packet captures`,builder:e=>e.command(j).command(Lt).command(Jt).command(rn).command(Mn).command(Gn).command(or).command(Dr).command(Hr).command(ca).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{la as default};
|