cf 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/README.md +7 -1
  2. package/dist/_meta/agent-context.json +26 -21
  3. package/dist/_meta/commands.json +7696 -18100
  4. package/dist/_meta/schemas.json +6411 -13925
  5. package/dist/{abuse-reports-dMIfUJ8v.mjs → abuse-reports-Ina5TlsU.mjs} +2 -2
  6. package/dist/{accounts-Kx1epdA1.mjs → accounts-B_joQcMi.mjs} +9 -9
  7. package/dist/{acm-Utu252kC.mjs → acm-_kIHqYME.mjs} +2 -2
  8. package/dist/{addressing-CBq7Z7Vq.mjs → addressing-CaFlw8y1.mjs} +10 -10
  9. package/dist/{agent-context-BGTU299M.mjs → agent-context-DMPfi54f.mjs} +1 -1
  10. package/dist/ai-CqnhNb_c.mjs +2 -0
  11. package/dist/ai-gateway-pgYGI519.mjs +8 -0
  12. package/dist/ai-search-eqQMPQol.mjs +7 -0
  13. package/dist/ai_gateway--vuVLnOm.mjs +4 -0
  14. package/dist/{alerting-CqmEIaKn.mjs → alerting-CPxHiYHb.mjs} +5 -5
  15. package/dist/{analytics-Dv-X8x7D.mjs → analytics-DSSRDZz8.mjs} +1 -1
  16. package/dist/analytics_engine-gWyfnsCs.mjs +2 -0
  17. package/dist/{api-gateway-CNv0IHTU.mjs → api-gateway-BXXGFCVR.mjs} +10 -10
  18. package/dist/argo-aC6A3JyX.mjs +2 -0
  19. package/dist/artifacts-HD4V2xpK.mjs +4 -0
  20. package/dist/audit-logs-BuExU_nz.mjs +2 -0
  21. package/dist/auth-CSC4yhEJ.mjs +9 -0
  22. package/dist/auth-D5hNsOFq.mjs +5 -0
  23. package/dist/billing-COaghyxl.mjs +2 -0
  24. package/dist/bot-management-DmEzeV1Y.mjs +5 -0
  25. package/dist/botnet-feed-ByEAXAkw.mjs +3 -0
  26. package/dist/brand-protection-dPrGe8sL.mjs +3 -0
  27. package/dist/browser-rendering-BiSGnpBf.mjs +4 -0
  28. package/dist/{build-DYkGW4dh.mjs → build-HuS9-R0V.mjs} +131 -131
  29. package/dist/{cache-DsoW6Xwv.mjs → cache-CY-7Lt71.mjs} +4 -4
  30. package/dist/calls-wOQGDWPl.mjs +4 -0
  31. package/dist/certificate-authorities-CtqzAtxQ.mjs +2 -0
  32. package/dist/chunk-6IEM75FG-BEjRFMGh.mjs +2 -0
  33. package/dist/client-certificates-CRf41xLe.mjs +3 -0
  34. package/dist/cloud-connector-BA5IRZUP.mjs +2 -0
  35. package/dist/{cloudforce-one-2Bhz8YdW.mjs → cloudforce-one-Bq_qPAWs.mjs} +20 -20
  36. package/dist/{completions-BwRpZQVn.mjs → completions-DOeHPdCG.mjs} +2 -2
  37. package/dist/config-B5k-XbwS.mjs +2 -0
  38. package/dist/connectivity-Bx3MgTHX.mjs +3 -0
  39. package/dist/connector-interrupts-D7ylweJZ.mjs +2 -0
  40. package/dist/connector-telemetry-events-6izV1kbP.mjs +2 -0
  41. package/dist/connector-telemetry-snapshots-BnjKbyxX.mjs +2 -0
  42. package/dist/connectors-DRt4e6d_.mjs +3 -0
  43. package/dist/content-scanning-Cd2vy5Sz.mjs +4 -0
  44. package/dist/context-jpewmual.mjs +2 -0
  45. package/dist/{custom-certificates-aAiEguR7.mjs → custom-certificates-DYE-9epx.mjs} +3 -3
  46. package/dist/{custom-hostnames-AG5yBHIi.mjs → custom-hostnames-CtuTdFcX.mjs} +4 -4
  47. package/dist/custom-nameservers-CWqA51in.mjs +3 -0
  48. package/dist/custom-pages-DeUKEFGe.mjs +4 -0
  49. package/dist/d1-DvWY9Gp4.mjs +4 -0
  50. package/dist/data-security-BPo6dIWu.mjs +6 -0
  51. package/dist/dcv-delegation-Bgf86J-r.mjs +2 -0
  52. package/dist/{deploy-CQial3kN.mjs → deploy-dVrgDUOp.mjs} +1 -1
  53. package/dist/{dev-B38LfCTl.mjs → dev-C01_Lby6.mjs} +1 -1
  54. package/dist/diagnostics-6nKPmVgz.mjs +3 -0
  55. package/dist/{dispatch-namespaces-DmHvoBOg.mjs → dispatch-namespaces-64lXx2WJ.mjs} +6 -6
  56. package/dist/dist-C6zxsVdY.mjs +306 -0
  57. package/dist/{dist-AIcZFk0U.mjs → dist-t_YrL25p.mjs} +7 -7
  58. package/dist/{dns-VMhQSr5n.mjs → dns-ClciFGxx.mjs} +13 -13
  59. package/dist/dns-firewall-DfUmXDCe.mjs +57 -0
  60. package/dist/durable-objects-CMaYZ-YU.mjs +2 -0
  61. package/dist/{email-routing-tIR2SFu-.mjs → email-routing-CGXhFqF5.mjs} +9 -9
  62. package/dist/{email-security-Ca1id3rZ.mjs → email-security-D5viPq8S.mjs} +7 -7
  63. package/dist/email-sending-C2jpc3gh.mjs +3 -0
  64. package/dist/{filters-A4dg_a68.mjs → filters-bzsFcWt0.mjs} +3 -3
  65. package/dist/{firewall-DWPQgYd9.mjs → firewall-DYZcTtIC.mjs} +10 -10
  66. package/dist/{fraud-BMkSsJGU.mjs → fraud-C03MtdZb.mjs} +1 -1
  67. package/dist/google-tag-gateway-Dfy887yA.mjs +2 -0
  68. package/dist/{healthchecks-CtIfrFql.mjs → healthchecks-DRoAlWgr.mjs} +3 -3
  69. package/dist/hostnames-CFgIVI3s.mjs +3 -0
  70. package/dist/hyperdrive-C7-gwTSV.mjs +18 -0
  71. package/dist/iam-DqVPzGrb.mjs +6 -0
  72. package/dist/images-BYfl4YgR.mjs +7 -0
  73. package/dist/index.mjs +1 -1
  74. package/dist/intel-duTEPIHc.mjs +3 -0
  75. package/dist/{ips-K4bzaGqd.mjs → ips-nv9INuWZ.mjs} +1 -1
  76. package/dist/keyless-certificates-CRCDVd3g.mjs +3 -0
  77. package/dist/{kv-8o27w_pY.mjs → kv-CZoV4tiv.mjs} +4 -4
  78. package/dist/leaked-credential-checks-DNIBg7Pe.mjs +3 -0
  79. package/dist/{load-balancers-DtG8nj25.mjs → load-balancers--OMg0HNt.mjs} +5 -5
  80. package/dist/{logpush-4L0njy1d.mjs → logpush-C0_lZTyY.mjs} +3 -3
  81. package/dist/{logs-B_Yp95hv.mjs → logs-BtpWZQfV.mjs} +2 -2
  82. package/dist/magic-cloud-networking-u6rwYbGg.mjs +5 -0
  83. package/dist/{magic-network-monitoring-BnwvM4-I.mjs → magic-network-monitoring-CKgQyRj4.mjs} +3 -3
  84. package/dist/{magic-transit-CXDyvhxq.mjs → magic-transit-CLhMcJ_-.mjs} +32 -33
  85. package/dist/managed-transforms-D0Z2mlth.mjs +3 -0
  86. package/dist/mtls-certificates-BL65NK5T.mjs +3 -0
  87. package/dist/{network-interconnects-rrr7red3.mjs → network-interconnects-Bgu9gmaG.mjs} +5 -5
  88. package/dist/oauth-Bk-F-tIO.mjs +52 -0
  89. package/dist/{observability-DWvpqnQJ.mjs → observability-BynRbTF4.mjs} +3 -3
  90. package/dist/open-YWOUIZ5Y-3jqSKAB1.mjs +4 -0
  91. package/dist/{organizations-T77D50Sq.mjs → organizations-BqJHyvMK.mjs} +3 -3
  92. package/dist/origin-ca-certificates-BGvYwm3C.mjs +3 -0
  93. package/dist/origin-post-quantum-encryption-9KOE8YPI.mjs +2 -0
  94. package/dist/{origin-tls-client-auth-CaVW1Ztp.mjs → origin-tls-client-auth-d3snC3vr.mjs} +3 -3
  95. package/dist/{output-BJFNwj7b.mjs → output-B6fBFRqe.mjs} +1 -1
  96. package/dist/{page-rules-CjZPTMQX.mjs → page-rules-EZHJePmn.mjs} +4 -4
  97. package/dist/{page-shield-D5RRNJCY.mjs → page-shield-CXJioWPs.mjs} +5 -5
  98. package/dist/{pages-CWJtJnL0.mjs → pages-D4aYteKk.mjs} +8 -8
  99. package/dist/{pipelines-B0L_7j9e.mjs → pipelines-G8Iusxq-.mjs} +5 -5
  100. package/dist/progress-DrDErV9w.mjs +2 -0
  101. package/dist/queues-DEkbKqZX.mjs +6 -0
  102. package/dist/{r2-DQIcyRtA.mjs → r2-CV0IkCAW.mjs} +9 -9
  103. package/dist/r2-data-catalog-NtqGC_a_.mjs +14 -0
  104. package/dist/radar-D986zPJr.mjs +2 -0
  105. package/dist/{rate-limits-DcrQV6Ar.mjs → rate-limits-B2wRsUX1.mjs} +3 -3
  106. package/dist/raw-fetch-_n0lMAnD.mjs +2 -0
  107. package/dist/{realtime-kit-CaquuVOE.mjs → realtime-kit-Ld3c5eU6.mjs} +9 -9
  108. package/dist/{registrar-Ko-xZemf.mjs → registrar-CDIwTz3G.mjs} +6 -6
  109. package/dist/request-tracers-D7SFMDik.mjs +2 -0
  110. package/dist/resource-sharing-YIQ04jXE.mjs +5 -0
  111. package/dist/{resource-tagging-C3qtLzCz.mjs → resource-tagging-Bd6Y03sg.mjs} +7 -7
  112. package/dist/rules-DHjLP5Kx.mjs +4 -0
  113. package/dist/{rulesets-CBgpeSvJ.mjs → rulesets-q4QABpKs.mjs} +7 -7
  114. package/dist/rum-SmT4HZmM.mjs +4 -0
  115. package/dist/{schema-D16TgWBg.mjs → schema-BR31o4P6.mjs} +1 -1
  116. package/dist/{schema-validation-Dgv_opM3.mjs → schema-validation-vVetgC_P.mjs} +5 -5
  117. package/dist/{scim-DdSEr4kZ.mjs → scim-ChOkZpNx.mjs} +2 -2
  118. package/dist/{session-COHHdS7A.mjs → sdk-DhIhH6GB.mjs} +4 -4
  119. package/dist/{secrets-store-7BfyvJLb.mjs → secrets-store-BAK9G12O.mjs} +12 -12
  120. package/dist/security-center-eScuYDKP.mjs +2 -0
  121. package/dist/security-txt-x7R4gmQu.mjs +3 -0
  122. package/dist/session-DHYCE-PM.mjs +93 -0
  123. package/dist/shared-BAjo72Lz.mjs +2 -0
  124. package/dist/{smart-shield-TeWZFnH2.mjs → smart-shield-CWlSsNi8.mjs} +2 -2
  125. package/dist/snippets-DrlgYJYp.mjs +4 -0
  126. package/dist/{spawn-DcppKGI5.mjs → spawn-CCGzKlC4.mjs} +1 -1
  127. package/dist/{spectrum-CTTZID8u.mjs → spectrum-pVGxb7u5.mjs} +6 -6
  128. package/dist/speed-ZFrMWDgd.mjs +4 -0
  129. package/dist/src-DU7FBCOX.mjs +108 -0
  130. package/dist/ssl-9JY05sYt.mjs +15 -0
  131. package/dist/stream-tRU39b8K.mjs +14 -0
  132. package/dist/{tenants-Bd7NGQ_m.mjs → tenants-HLGUazms.mjs} +1 -1
  133. package/dist/{token-validation-DAgtFOvs.mjs → token-validation-_VdamKpz.mjs} +4 -4
  134. package/dist/{tools-DXQmfFuE.mjs → tools-D_hfUU_Z.mjs} +1 -1
  135. package/dist/{turnstile-cfdaO4ca.mjs → turnstile-BRzXd28B.mjs} +4 -4
  136. package/dist/{ui-D4KtlMh9.mjs → ui-erjBdVKL.mjs} +1 -1
  137. package/dist/url-normalization-D-NxuLtN.mjs +3 -0
  138. package/dist/url-scanner-BzzR6iDx.mjs +2 -0
  139. package/dist/{user-CAo-yCJA.mjs → user-C4omq__w.mjs} +2 -2
  140. package/dist/vectorize-By6EqcNR.mjs +4 -0
  141. package/dist/{versions-CUwWJWmy.mjs → versions-CBHwWPAM.mjs} +1 -1
  142. package/dist/{waiting-rooms-Dln5ICg5.mjs → waiting-rooms-u6KwrzWd.mjs} +6 -6
  143. package/dist/{web3-HQJRm38W.mjs → web3-DQ5dmE9W.mjs} +3 -3
  144. package/dist/{workers-Dg7ddG2Q.mjs → workers-D8Be7_as.mjs} +14 -14
  145. package/dist/workers-builds-BE3W3qNk.mjs +7 -0
  146. package/dist/{workflows-VquuSh2J.mjs → workflows-BWWufqFA.mjs} +3 -3
  147. package/dist/zaraz-Bsa9AvVL.mjs +2 -0
  148. package/dist/{zero-trust-CP96wnSh.mjs → zero-trust-UNVZFnKu.mjs} +87 -87
  149. package/dist/zero_trust-B0_Rk4p2.mjs +3 -0
  150. package/dist/zones-BXtdwt6E.mjs +21 -0
  151. package/package.json +4 -4
  152. package/dist/ai-DOOKLPkG.mjs +0 -2
  153. package/dist/ai-gateway-Cj1T3avF.mjs +0 -8
  154. package/dist/ai-search-CQF_Sn7d.mjs +0 -7
  155. package/dist/ai_gateway-C3fH22C0.mjs +0 -4
  156. package/dist/analytics_engine-DdXVR8z2.mjs +0 -2
  157. package/dist/argo-CX_A4kcn.mjs +0 -2
  158. package/dist/audit-logs-BfBf3oo-.mjs +0 -2
  159. package/dist/auth-SyWhMmPu.mjs +0 -6
  160. package/dist/auth-ffdf9yR0.mjs +0 -135
  161. package/dist/autorag-BuGhGTeZ.mjs +0 -2
  162. package/dist/billing-PoG81XaQ.mjs +0 -2
  163. package/dist/bot-management-CFvtVx62.mjs +0 -5
  164. package/dist/botnet-feed-B-M4Yu0W.mjs +0 -3
  165. package/dist/brand-protection-D05Eg-_6.mjs +0 -3
  166. package/dist/browser-rendering-xu8F_Rrv.mjs +0 -4
  167. package/dist/calls-CZbO7TyR.mjs +0 -4
  168. package/dist/certificate-authorities-D2yr7_3t.mjs +0 -2
  169. package/dist/client-certificates-MJcDsTId.mjs +0 -3
  170. package/dist/cloud-connector-DWOrN2eM.mjs +0 -2
  171. package/dist/config-DYzlVxcB.mjs +0 -2
  172. package/dist/connectivity-BX8C7tvK.mjs +0 -3
  173. package/dist/content-scanning-r6uzMO1r.mjs +0 -4
  174. package/dist/context-DGlHRGWM.mjs +0 -2
  175. package/dist/custom-nameservers-D1DtlRue.mjs +0 -3
  176. package/dist/custom-pages-DQCi2plU.mjs +0 -4
  177. package/dist/d1-DbnYhw45.mjs +0 -4
  178. package/dist/data-security-D_EtYBfo.mjs +0 -6
  179. package/dist/dcv-delegation-CHspSzTI.mjs +0 -2
  180. package/dist/diagnostics-BJQGjVJn.mjs +0 -3
  181. package/dist/dist-DNBSHor6.mjs +0 -301
  182. package/dist/dns-firewall-B4DVXFBQ.mjs +0 -57
  183. package/dist/durable-objects-CTboySEo.mjs +0 -2
  184. package/dist/email-sending-DwWKc5jC.mjs +0 -3
  185. package/dist/google-tag-gateway-BGD49nRC.mjs +0 -2
  186. package/dist/hostnames-BiomxukN.mjs +0 -3
  187. package/dist/hyperdrive-Da104VaQ.mjs +0 -18
  188. package/dist/iam-BIGKo0WW.mjs +0 -6
  189. package/dist/images-BO8FbDAa.mjs +0 -5
  190. package/dist/intel-CY6_79v8.mjs +0 -3
  191. package/dist/keyless-certificates-CZC-L8gM.mjs +0 -3
  192. package/dist/leaked-credential-checks-qLzRyu85.mjs +0 -3
  193. package/dist/magic-cloud-networking-CSOM3EM-.mjs +0 -5
  194. package/dist/managed-transforms-D15yVbZx.mjs +0 -3
  195. package/dist/mtls-certificates-D8k0AXWK.mjs +0 -3
  196. package/dist/origin-ca-certificates-DXIvD8H5.mjs +0 -3
  197. package/dist/origin-post-quantum-encryption-C8oOczyV.mjs +0 -2
  198. package/dist/progress-CrCGTq7N.mjs +0 -2
  199. package/dist/queues-CN6DPhRR.mjs +0 -6
  200. package/dist/r2-data-catalog-Bbo93TJx.mjs +0 -14
  201. package/dist/radar-Bxb0WX8V.mjs +0 -2
  202. package/dist/raw-fetch-Dlccg0Tr.mjs +0 -2
  203. package/dist/request-tracers-DOW_reTJ.mjs +0 -2
  204. package/dist/resource-sharing-D7TX0JV0.mjs +0 -5
  205. package/dist/rules-BXRADHL5.mjs +0 -4
  206. package/dist/rum-BjPptTUP.mjs +0 -4
  207. package/dist/security-center-DAy6AKtT.mjs +0 -2
  208. package/dist/security-txt-xAMb7K6Y.mjs +0 -3
  209. package/dist/shared-AGtpXwwL.mjs +0 -2
  210. package/dist/snippets-CCSsCXVs.mjs +0 -4
  211. package/dist/speed-CuzTE0AL.mjs +0 -4
  212. package/dist/src-BW6vfAwE.mjs +0 -108
  213. package/dist/ssl-BWA2LdwC.mjs +0 -15
  214. package/dist/stream-GFsIZ-pP.mjs +0 -14
  215. package/dist/url-normalization-B5RN4nLD.mjs +0 -3
  216. package/dist/url-scanner-BrZ1L9OC.mjs +0 -2
  217. package/dist/vectorize-C7_oQlaI.mjs +0 -4
  218. package/dist/workers-builds-AVfx8IyL.mjs +0 -7
  219. package/dist/zaraz-xYSWIV4P.mjs +0 -2
  220. package/dist/zones-BSgmZ9WC.mjs +0 -21
  221. /package/dist/{body-parser-DKa8Ipg1.mjs → body-parser-DWSy7uZ8.mjs} +0 -0
  222. /package/dist/{cli-types-CRIDdDw3.mjs → cli-types-BeyOc81z.mjs} +0 -0
  223. /package/dist/{input-validation-zEO81MWN.mjs → input-validation-_fMCApaH.mjs} +0 -0
  224. /package/dist/{lib-Eu1wXxuh.mjs → lib-4PQI6yRW.mjs} +0 -0
  225. /package/dist/{local-VJaJ3BZ1.mjs → local-CYc9q7l2.mjs} +0 -0
  226. /package/dist/{metadata-5VwHPW6C.mjs → metadata-OOwvpR8m.mjs} +0 -0
  227. /package/dist/{resolve-4-OSeHlK.mjs → resolve-C3h-mwp7.mjs} +0 -0
  228. /package/dist/{theme-BklJDrb2.mjs → theme-DbNbIY4d.mjs} +0 -0
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import{C as e,D as t,S as n,T as r,_ as i,n as a}from"./auth-ffdf9yR0.mjs";import{n as o,t as s}from"./body-parser-DKa8Ipg1.mjs";import{t as c}from"./output-BJFNwj7b.mjs";import{n as l,t as u}from"./progress-CrCGTq7N.mjs";import{n as d}from"./input-validation-zEO81MWN.mjs";import{t as f}from"./local-VJaJ3BZ1.mjs";import{t as p}from"./cli-types-CRIDdDw3.mjs";function m(e){return e.option(`adaptive-routing-failover-across-pools`,{type:`boolean`,description:"Extends zero-downtime failover of requests to healthy origins from alternate pools, when no healthy alternate exists in the same pool, according to the failover order defined by traffic and origin steering. When set false (the default) zero-downtime failover will only occur between origins within the same pool. See `session_affinity_attributes` for control over when sessions are broken or reassigned.",default:!1}).option(`default-pools`,{type:`string`,array:!0,description:`A list of pool IDs ordered by their failover priority. Pools defined here are used by default, or when region_pools are not configured for a given region.`}).option(`description`,{type:`string`,description:`Object description.`}).option(`fallback-pool`,{type:`string`,description:`The pool ID to use when all other pools are detected as unhealthy.`}).option(`location-strategy-mode`,{type:`string`,description:'Determines the authoritative location when ECS is not preferred, does not exist in the request, or its GeoIP lookup is unsuccessful.\n- `"pop"`: Use the Cloudflare PoP location.\n- `"resolver_ip"`: Use the DNS resolver GeoIP location. If the GeoIP lookup is unsuccessful, use the Cloudflare PoP location.',choices:[`pop`,`resolver_ip`],default:`pop`}).option(`location-strategy-prefer-ecs`,{type:`string`,description:'Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the authoritative location.\n- `"always"`: Always prefer ECS.\n- `"never"`: Never prefer ECS.\n- `"proximity"`: Prefer ECS only when `steering_policy="proximity"`.\n- `"geo"`: Prefer ECS only when `steering_policy="geo"`.',choices:[`always`,`never`,`proximity`,`geo`],default:`proximity`}).option(`name`,{type:`string`,description:`The DNS hostname to associate with your Load Balancer. If this hostname already exists as a DNS record in Cloudflare's DNS, the Load Balancer will take precedence and the DNS record will not be used.`}).option(`networks`,{type:`string`,array:!0,description:`List of networks where Load Balancer or Pool is enabled.`}).option(`proxied`,{type:`boolean`,description:`Whether the hostname should be gray clouded (false) or orange clouded (true).`,default:!1}).option(`random-steering-default-weight`,{type:`number`,description:`The default weight for pools in the load balancer that are not specified in the pool_weights map.`,default:1}).option(`session-affinity`,{type:`string`,description:'Specifies the type of session affinity the load balancer should use unless specified as `"none"`. The supported types are: - `"cookie"`: On the first request to a proxied load balancer, a cookie is generated, encoding information of which origin the request will be forwarded to. Subsequent requests, by the same client to the same load balancer, will be sent to the origin server the cookie encodes, for the duration of the cookie and as long as the origin server remains healthy. If the cookie has expired or the origin server is unhealthy, then a new origin server is calculated and used. - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin selection is stable and based on the client\'s ip address. - `"header"`: On the first request to a proxied load balancer, a session key based on the configured HTTP headers (see `session_affinity_attributes.headers`) is generated, encoding the request headers used for storing in the load balancer session state which origin the request will be forwarded to. Subsequent requests to the load balancer with the same headers will be sent to the same origin server, for the duration of the session and as long as the origin server remains healthy. If the session has been idle for the duration of `session_affinity_ttl` seconds or the origin server is unhealthy, then a new origin server is calculated and used. See `headers` in `session_affinity_attributes` for additional required configuration.',choices:[`none`,`cookie`,`ip_cookie`,`header`],default:`none`}).option(`session-affinity-attributes-drain-duration`,{type:`number`,description:`Configures the drain duration in seconds. This field is only used when session affinity is enabled on the load balancer.`}).option(`session-affinity-attributes-headers`,{type:`string`,array:!0,description:'Configures the names of HTTP headers to base session affinity on when header `session_affinity` is enabled. At least one HTTP header name must be provided. To specify the exact cookies to be used, include an item in the following format: `"cookie:<cookie-name-1>,<cookie-name-2>"` (example) where everything after the colon is a comma-separated list of cookie names. Providing only `"cookie"` will result in all cookies being used. The default max number of HTTP header names that can be provided depends on your plan: 5 for Enterprise, 1 for all other plans.'}).option(`session-affinity-attributes-require-all-headers`,{type:`boolean`,description:'When header `session_affinity` is enabled, this option can be used to specify how HTTP headers on load balancing requests will be used. The supported values are: - `"true"`: Load balancing requests must contain *all* of the HTTP headers specified by the `headers` session affinity attribute, otherwise sessions aren\'t created. - `"false"`: Load balancing requests must contain *at least one* of the HTTP headers specified by the `headers` session affinity attribute, otherwise sessions aren\'t created.',default:!1}).option(`session-affinity-attributes-samesite`,{type:`string`,description:`Configures the SameSite attribute on session affinity cookie. Value "Auto" will be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: when using value "None", the secure attribute can not be set to "Never".`,choices:[`Auto`,`Lax`,`None`,`Strict`],default:`Auto`}).option(`session-affinity-attributes-secure`,{type:`string`,description:`Configures the Secure attribute on session affinity cookie. Value "Always" indicates the Secure attribute will be set in the Set-Cookie header, "Never" indicates the Secure attribute will not be set, and "Auto" will set the Secure attribute depending if Always Use HTTPS is enabled.`,choices:[`Auto`,`Always`,`Never`],default:`Auto`}).option(`session-affinity-attributes-zero-downtime-failover`,{type:`string`,description:'Configures the zero-downtime failover between origins within a pool when session affinity is enabled. This feature is currently incompatible with Argo, Tiered Cache, and Bandwidth Alliance. The supported values are: - `"none"`: No failover takes place for sessions pinned to the origin (default). - `"temporary"`: Traffic will be sent to another other healthy origin until the originally pinned origin is available; note that this can potentially result in heavy origin flapping. - `"sticky"`: The session affinity cookie is updated and subsequent requests are sent to the new origin. Note: Zero-downtime failover with sticky sessions is currently not supported for session affinity by header.',choices:[`none`,`temporary`,`sticky`],default:`none`}).option(`session-affinity-ttl`,{type:`number`,description:'Time, in seconds, until a client\'s session expires after being created. Once the expiry time has been reached, subsequent requests may get sent to a different origin server. The accepted ranges per `session_affinity` policy are: - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used unless explicitly set. The accepted range of values is between [1800, 604800]. - `"header"`: The current default of 1800 seconds will be used unless explicitly set. The accepted range of values is between [30, 3600]. Note: With session affinity by header, sessions only expire after they haven\'t been used for the number of seconds specified.'}).option(`steering-policy`,{type:`string`,description:'Steering Policy for this load balancer.\n- `"off"`: Use `default_pools`.\n- `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied requests, the country for `country_pools` is determined by `location_strategy`.\n- `"random"`: Select a pool randomly.\n- `"dynamic_latency"`: Use round trip time to select the closest pool in default_pools (requires pool health checks).\n- `"proximity"`: Use the pools\' latitude and longitude to select the closest pool using the Cloudflare PoP location for proxied requests or the location determined by `location_strategy` for non-proxied requests.\n- `"least_outstanding_requests"`: Select a pool by taking into consideration `random_steering` weights, as well as each pool\'s number of outstanding requests. Pools with more pending requests are weighted proportionately less relative to others.\n- `"least_connections"`: Select a pool by taking into consideration `random_steering` weights, as well as each pool\'s number of open connections. Pools with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.\n- `""`: Will map to `"geo"` if you use `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`.',choices:[`off`,`geo`,`random`,`dynamic_latency`,`proximity`,`least_outstanding_requests`,`least_connections`],default:``}).option(`ttl`,{type:`number`,description:`Time to live (TTL) of the DNS entry for the IP address returned by this load balancer. This only applies to gray-clouded (unproxied) load balancers.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ee={command:`create`,describe:`Create a new load balancer.`,builder:m,handler:async e=>{if(e.dryRun){l({command:`cf load-balancers create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/load_balancers`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?s({adaptive_routing:{failover_across_pools:e[`adaptive-routing-failover-across-pools`]},default_pools:e[`default-pools`],description:d(e.description,`description`,`text`),fallback_pool:d(e[`fallback-pool`],`fallback-pool`,`text`),location_strategy:{mode:d(e[`location-strategy-mode`],`location-strategy-mode`,`text`),prefer_ecs:d(e[`location-strategy-prefer-ecs`],`location-strategy-prefer-ecs`,`text`)},name:d(e.name,`name`,`text`),networks:e.networks,proxied:e.proxied,random_steering:{default_weight:e[`random-steering-default-weight`]},session_affinity:d(e[`session-affinity`],`session-affinity`,`text`),session_affinity_attributes:{drain_duration:e[`session-affinity-attributes-drain-duration`],headers:e[`session-affinity-attributes-headers`],require_all_headers:e[`session-affinity-attributes-require-all-headers`],samesite:d(e[`session-affinity-attributes-samesite`],`session-affinity-attributes-samesite`,`text`),secure:d(e[`session-affinity-attributes-secure`],`session-affinity-attributes-secure`,`text`),zero_downtime_failover:d(e[`session-affinity-attributes-zero-downtime-failover`],`session-affinity-attributes-zero-downtime-failover`,`text`)},session_affinity_ttl:e[`session-affinity-ttl`],steering_policy:d(e[`steering-policy`],`steering-policy`,`text`),ttl:e.ttl}):o(e.body)});return}let r=await a(e),i=await n({zone:e.zone},r,{quiet:e.quiet});if(e.zoneId=i,e.body){let t=o(e.body);c(await u(`Creating`,async()=>r.loadBalancers.create({...t,zone_id:i})),{successLabel:`Created`});return}if(e[`default-pools`]===void 0)throw Error(`--default-pools is required (or pass --body with this field set).`);e[`fallback-pool`]===void 0&&(e[`fallback-pool`]=await t(`fallback-pool`,`The pool ID to use when all other pools are detected as unhealthy.`)),e.name===void 0&&(e.name=await t(`name`,`The DNS hostname to associate with your Load Balancer. If this hostname already exists as a DNS record in Cloudflare's DNS, the Load Balancer will take precedence and the DNS record will not be used.`));let f=s({adaptive_routing:{failover_across_pools:e[`adaptive-routing-failover-across-pools`]},default_pools:e[`default-pools`],description:d(e.description,`description`,`text`),fallback_pool:d(e[`fallback-pool`],`fallback-pool`,`text`),location_strategy:{mode:d(e[`location-strategy-mode`],`location-strategy-mode`,`text`),prefer_ecs:d(e[`location-strategy-prefer-ecs`],`location-strategy-prefer-ecs`,`text`)},name:d(e.name,`name`,`text`),networks:e.networks,proxied:e.proxied,random_steering:{default_weight:e[`random-steering-default-weight`]},session_affinity:d(e[`session-affinity`],`session-affinity`,`text`),session_affinity_attributes:{drain_duration:e[`session-affinity-attributes-drain-duration`],headers:e[`session-affinity-attributes-headers`],require_all_headers:e[`session-affinity-attributes-require-all-headers`],samesite:d(e[`session-affinity-attributes-samesite`],`session-affinity-attributes-samesite`,`text`),secure:d(e[`session-affinity-attributes-secure`],`session-affinity-attributes-secure`,`text`),zero_downtime_failover:d(e[`session-affinity-attributes-zero-downtime-failover`],`session-affinity-attributes-zero-downtime-failover`,`text`)},session_affinity_ttl:e[`session-affinity-ttl`],steering_policy:d(e[`steering-policy`],`steering-policy`,`text`),ttl:e.ttl});c(await u(`Creating`,async()=>r.loadBalancers.create({...f,zone_id:i})),{successLabel:`Created`})}};function te(e){return e.positional(`load-balancer-id`,{type:`string`,description:`Load balancer 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 h={command:`delete <load-balancer-id>`,describe:`Delete a configured load balancer.`,builder:te,handler:async e=>{if(e.dryRun){l({command:`cf load-balancers delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/load_balancers/${e[`load-balancer-id`]==null?`<load-balancer-id>`:encodeURIComponent(String(e[`load-balancer-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"load-balancer-id":String(e[`load-balancer-id`]??``)},bodyKind:`none`});return}let t=await a(e),i=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,!await r({force:!!e.force})){process.stderr.write(`Aborted.
3
- `);return}c(await u(`Deleting`,async()=>t.loadBalancers.delete({zone_id:i,load_balancer_id:e[`load-balancer-id`]})),{successLabel:`Deleted`})}};function g(e){return e.positional(`load-balancer-id`,{type:`string`,description:`Load balancer ID`,demandOption:!0}).option(`adaptive-routing-failover-across-pools`,{type:`boolean`,description:"Extends zero-downtime failover of requests to healthy origins from alternate pools, when no healthy alternate exists in the same pool, according to the failover order defined by traffic and origin steering. When set false (the default) zero-downtime failover will only occur between origins within the same pool. See `session_affinity_attributes` for control over when sessions are broken or reassigned."}).option(`default-pools`,{type:`string`,array:!0,description:`A list of pool IDs ordered by their failover priority. Pools defined here are used by default, or when region_pools are not configured for a given region.`}).option(`description`,{type:`string`,description:`Object description.`}).option(`enabled`,{type:`boolean`,description:`Whether to enable (the default) this load balancer.`}).option(`fallback-pool`,{type:`string`,description:`The pool ID to use when all other pools are detected as unhealthy.`}).option(`location-strategy-mode`,{type:`string`,description:'Determines the authoritative location when ECS is not preferred, does not exist in the request, or its GeoIP lookup is unsuccessful.\n- `"pop"`: Use the Cloudflare PoP location.\n- `"resolver_ip"`: Use the DNS resolver GeoIP location. If the GeoIP lookup is unsuccessful, use the Cloudflare PoP location.',choices:[`pop`,`resolver_ip`]}).option(`location-strategy-prefer-ecs`,{type:`string`,description:'Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the authoritative location.\n- `"always"`: Always prefer ECS.\n- `"never"`: Never prefer ECS.\n- `"proximity"`: Prefer ECS only when `steering_policy="proximity"`.\n- `"geo"`: Prefer ECS only when `steering_policy="geo"`.',choices:[`always`,`never`,`proximity`,`geo`]}).option(`name`,{type:`string`,description:`The DNS hostname to associate with your Load Balancer. If this hostname already exists as a DNS record in Cloudflare's DNS, the Load Balancer will take precedence and the DNS record will not be used.`}).option(`proxied`,{type:`boolean`,description:`Whether the hostname should be gray clouded (false) or orange clouded (true).`}).option(`random-steering-default-weight`,{type:`number`,description:`The default weight for pools in the load balancer that are not specified in the pool_weights map.`}).option(`session-affinity`,{type:`string`,description:'Specifies the type of session affinity the load balancer should use unless specified as `"none"`. The supported types are: - `"cookie"`: On the first request to a proxied load balancer, a cookie is generated, encoding information of which origin the request will be forwarded to. Subsequent requests, by the same client to the same load balancer, will be sent to the origin server the cookie encodes, for the duration of the cookie and as long as the origin server remains healthy. If the cookie has expired or the origin server is unhealthy, then a new origin server is calculated and used. - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin selection is stable and based on the client\'s ip address. - `"header"`: On the first request to a proxied load balancer, a session key based on the configured HTTP headers (see `session_affinity_attributes.headers`) is generated, encoding the request headers used for storing in the load balancer session state which origin the request will be forwarded to. Subsequent requests to the load balancer with the same headers will be sent to the same origin server, for the duration of the session and as long as the origin server remains healthy. If the session has been idle for the duration of `session_affinity_ttl` seconds or the origin server is unhealthy, then a new origin server is calculated and used. See `headers` in `session_affinity_attributes` for additional required configuration.',choices:[`none`,`cookie`,`ip_cookie`,`header`]}).option(`session-affinity-attributes-drain-duration`,{type:`number`,description:`Configures the drain duration in seconds. This field is only used when session affinity is enabled on the load balancer.`}).option(`session-affinity-attributes-headers`,{type:`string`,array:!0,description:'Configures the names of HTTP headers to base session affinity on when header `session_affinity` is enabled. At least one HTTP header name must be provided. To specify the exact cookies to be used, include an item in the following format: `"cookie:<cookie-name-1>,<cookie-name-2>"` (example) where everything after the colon is a comma-separated list of cookie names. Providing only `"cookie"` will result in all cookies being used. The default max number of HTTP header names that can be provided depends on your plan: 5 for Enterprise, 1 for all other plans.'}).option(`session-affinity-attributes-require-all-headers`,{type:`boolean`,description:'When header `session_affinity` is enabled, this option can be used to specify how HTTP headers on load balancing requests will be used. The supported values are: - `"true"`: Load balancing requests must contain *all* of the HTTP headers specified by the `headers` session affinity attribute, otherwise sessions aren\'t created. - `"false"`: Load balancing requests must contain *at least one* of the HTTP headers specified by the `headers` session affinity attribute, otherwise sessions aren\'t created.'}).option(`session-affinity-attributes-samesite`,{type:`string`,description:`Configures the SameSite attribute on session affinity cookie. Value "Auto" will be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: when using value "None", the secure attribute can not be set to "Never".`,choices:[`Auto`,`Lax`,`None`,`Strict`]}).option(`session-affinity-attributes-secure`,{type:`string`,description:`Configures the Secure attribute on session affinity cookie. Value "Always" indicates the Secure attribute will be set in the Set-Cookie header, "Never" indicates the Secure attribute will not be set, and "Auto" will set the Secure attribute depending if Always Use HTTPS is enabled.`,choices:[`Auto`,`Always`,`Never`]}).option(`session-affinity-attributes-zero-downtime-failover`,{type:`string`,description:'Configures the zero-downtime failover between origins within a pool when session affinity is enabled. This feature is currently incompatible with Argo, Tiered Cache, and Bandwidth Alliance. The supported values are: - `"none"`: No failover takes place for sessions pinned to the origin (default). - `"temporary"`: Traffic will be sent to another other healthy origin until the originally pinned origin is available; note that this can potentially result in heavy origin flapping. - `"sticky"`: The session affinity cookie is updated and subsequent requests are sent to the new origin. Note: Zero-downtime failover with sticky sessions is currently not supported for session affinity by header.',choices:[`none`,`temporary`,`sticky`]}).option(`session-affinity-ttl`,{type:`number`,description:'Time, in seconds, until a client\'s session expires after being created. Once the expiry time has been reached, subsequent requests may get sent to a different origin server. The accepted ranges per `session_affinity` policy are: - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used unless explicitly set. The accepted range of values is between [1800, 604800]. - `"header"`: The current default of 1800 seconds will be used unless explicitly set. The accepted range of values is between [30, 3600]. Note: With session affinity by header, sessions only expire after they haven\'t been used for the number of seconds specified.'}).option(`steering-policy`,{type:`string`,description:'Steering Policy for this load balancer.\n- `"off"`: Use `default_pools`.\n- `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied requests, the country for `country_pools` is determined by `location_strategy`.\n- `"random"`: Select a pool randomly.\n- `"dynamic_latency"`: Use round trip time to select the closest pool in default_pools (requires pool health checks).\n- `"proximity"`: Use the pools\' latitude and longitude to select the closest pool using the Cloudflare PoP location for proxied requests or the location determined by `location_strategy` for non-proxied requests.\n- `"least_outstanding_requests"`: Select a pool by taking into consideration `random_steering` weights, as well as each pool\'s number of outstanding requests. Pools with more pending requests are weighted proportionately less relative to others.\n- `"least_connections"`: Select a pool by taking into consideration `random_steering` weights, as well as each pool\'s number of open connections. Pools with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.\n- `""`: Will map to `"geo"` if you use `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`.',choices:[`off`,`geo`,`random`,`dynamic_latency`,`proximity`,`least_outstanding_requests`,`least_connections`]}).option(`ttl`,{type:`number`,description:`Time to live (TTL) of the DNS entry for the IP address returned by this load balancer. This only applies to gray-clouded (unproxied) load balancers.`}).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 _={command:`edit <load-balancer-id>`,describe:`Apply changes to an existing load balancer, overwriting the supplied properties.`,builder:g,handler:async e=>{if(e.dryRun){l({command:`cf load-balancers edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/load_balancers/${e[`load-balancer-id`]==null?`<load-balancer-id>`:encodeURIComponent(String(e[`load-balancer-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"load-balancer-id":String(e[`load-balancer-id`]??``)},bodyKind:`json`,body:e.body===void 0?s({adaptive_routing:{failover_across_pools:e[`adaptive-routing-failover-across-pools`]},default_pools:e[`default-pools`],description:d(e.description,`description`,`text`),enabled:e.enabled,fallback_pool:d(e[`fallback-pool`],`fallback-pool`,`text`),location_strategy:{mode:d(e[`location-strategy-mode`],`location-strategy-mode`,`text`),prefer_ecs:d(e[`location-strategy-prefer-ecs`],`location-strategy-prefer-ecs`,`text`)},name:d(e.name,`name`,`text`),proxied:e.proxied,random_steering:{default_weight:e[`random-steering-default-weight`]},session_affinity:d(e[`session-affinity`],`session-affinity`,`text`),session_affinity_attributes:{drain_duration:e[`session-affinity-attributes-drain-duration`],headers:e[`session-affinity-attributes-headers`],require_all_headers:e[`session-affinity-attributes-require-all-headers`],samesite:d(e[`session-affinity-attributes-samesite`],`session-affinity-attributes-samesite`,`text`),secure:d(e[`session-affinity-attributes-secure`],`session-affinity-attributes-secure`,`text`),zero_downtime_failover:d(e[`session-affinity-attributes-zero-downtime-failover`],`session-affinity-attributes-zero-downtime-failover`,`text`)},session_affinity_ttl:e[`session-affinity-ttl`],steering_policy:d(e[`steering-policy`],`steering-policy`,`text`),ttl:e.ttl}):o(e.body)});return}let t=await a(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=o(e.body);c(await u(`Updating`,async()=>t.loadBalancers.edit({...n,zone_id:r,load_balancer_id:e[`load-balancer-id`]})),{successLabel:`Updated`});return}let i=s({adaptive_routing:{failover_across_pools:e[`adaptive-routing-failover-across-pools`]},default_pools:e[`default-pools`],description:d(e.description,`description`,`text`),enabled:e.enabled,fallback_pool:d(e[`fallback-pool`],`fallback-pool`,`text`),location_strategy:{mode:d(e[`location-strategy-mode`],`location-strategy-mode`,`text`),prefer_ecs:d(e[`location-strategy-prefer-ecs`],`location-strategy-prefer-ecs`,`text`)},name:d(e.name,`name`,`text`),proxied:e.proxied,random_steering:{default_weight:e[`random-steering-default-weight`]},session_affinity:d(e[`session-affinity`],`session-affinity`,`text`),session_affinity_attributes:{drain_duration:e[`session-affinity-attributes-drain-duration`],headers:e[`session-affinity-attributes-headers`],require_all_headers:e[`session-affinity-attributes-require-all-headers`],samesite:d(e[`session-affinity-attributes-samesite`],`session-affinity-attributes-samesite`,`text`),secure:d(e[`session-affinity-attributes-secure`],`session-affinity-attributes-secure`,`text`),zero_downtime_failover:d(e[`session-affinity-attributes-zero-downtime-failover`],`session-affinity-attributes-zero-downtime-failover`,`text`)},session_affinity_ttl:e[`session-affinity-ttl`],steering_policy:d(e[`steering-policy`],`steering-policy`,`text`),ttl:e.ttl});c(await u(`Updating`,async()=>t.loadBalancers.edit({...i,zone_id:r,load_balancer_id:e[`load-balancer-id`]})),{successLabel:`Updated`})}};function v(e){return e.positional(`load-balancer-id`,{type:`string`,description:`Load balancer ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`get <load-balancer-id>`,describe:`Fetch a single configured load balancer.`,builder:v,handler:async e=>{if(e.dryRun){l({command:`cf load-balancers get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/load_balancers/${e[`load-balancer-id`]==null?`<load-balancer-id>`:encodeURIComponent(String(e[`load-balancer-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"load-balancer-id":String(e[`load-balancer-id`]??``)},bodyKind:`none`});return}let t=await a(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,c(await u(`Loading`,async()=>t.loadBalancers.get({zone_id:r,load_balancer_id:e[`load-balancer-id`]})),{successLabel:`Loaded`})}};function b(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`list`,describe:`List configured load balancers.`,builder:b,handler:async e=>{if(e.dryRun){l({command:`cf load-balancers list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/load_balancers`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await a(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,c(await u(`Loading`,async()=>t.loadBalancers.list({zone_id:r})),{successLabel:`Loaded`})}};function S(e){return e.option(`description`,{type:`string`,description:`A short description of the monitor group`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const C={command:`create`,describe:`Create a new monitor group.`,builder:S,handler:async n=>{if(n.dryRun){l({command:`cf load-balancers monitor-groups create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/load_balancers/monitor_groups`,pathParams:{},bodyKind:`json`,body:n.body===void 0?s({description:d(n.description,`description`,`text`)}):o(n.body)});return}let r=await a(n),p=n.local?f:await i(r);if(n.accountId=p,n.body){let e=o(n.body);c(await u(`Creating`,async()=>r.loadBalancers.monitorGroups.create({body:e,account_id:p})),{successLabel:`Created`});return}n.description===void 0&&(n.description=await t(`description`,`A short description of the monitor group`));let m=s({description:d(n.description,`description`,`text`)});c(await u(`Creating`,async()=>r.loadBalancers.monitorGroups.create({body:m,account_id:p})),{successLabel:`Created`})}};function w(e){return e.positional(`monitor-group-id`,{type:`string`,description:`Monitor group 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 T={command:`delete <monitor-group-id>`,describe:`Delete a configured monitor group.`,builder:w,handler:async t=>{if(t.dryRun){l({command:`cf load-balancers monitor-groups delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/load_balancers/monitor_groups/${t[`monitor-group-id`]==null?`<monitor-group-id>`:encodeURIComponent(String(t[`monitor-group-id`]))}`,pathParams:{"monitor-group-id":String(t[`monitor-group-id`]??``)},bodyKind:`none`});return}let n=await a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force})){process.stderr.write(`Aborted.
4
- `);return}c(await u(`Deleting`,async()=>n.loadBalancers.monitorGroups.delete({account_id:o,monitor_group_id:t[`monitor-group-id`]})),{successLabel:`Deleted`})}};function E(e){return e.positional(`monitor-group-id`,{type:`string`,description:`Monitor group ID`,demandOption:!0}).option(`description`,{type:`string`,description:`A short description of the monitor group`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const D={command:`edit <monitor-group-id>`,describe:`Apply changes to an existing monitor group, overwriting the supplied properties.`,builder:E,handler:async n=>{if(n.dryRun){l({command:`cf load-balancers monitor-groups edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/load_balancers/monitor_groups/${n[`monitor-group-id`]==null?`<monitor-group-id>`:encodeURIComponent(String(n[`monitor-group-id`]))}`,pathParams:{"monitor-group-id":String(n[`monitor-group-id`]??``)},bodyKind:`json`,body:n.body===void 0?s({description:d(n.description,`description`,`text`)}):o(n.body)});return}let r=await a(n),p=n.local?f:await i(r);if(n.accountId=p,n.body){let e=o(n.body);c(await u(`Updating`,async()=>r.loadBalancers.monitorGroups.edit({body:e,account_id:p,monitor_group_id:n[`monitor-group-id`]})),{successLabel:`Updated`});return}n.description===void 0&&(n.description=await t(`description`,`A short description of the monitor group`));let m=s({description:d(n.description,`description`,`text`)});c(await u(`Updating`,async()=>r.loadBalancers.monitorGroups.edit({body:m,account_id:p,monitor_group_id:n[`monitor-group-id`]})),{successLabel:`Updated`})}};function O(e){return e.positional(`monitor-group-id`,{type:`string`,description:`Monitor group ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`get <monitor-group-id>`,describe:`Fetch a single configured monitor group.`,builder:O,handler:async t=>{if(t.dryRun){l({command:`cf load-balancers monitor-groups get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/load_balancers/monitor_groups/${t[`monitor-group-id`]==null?`<monitor-group-id>`:encodeURIComponent(String(t[`monitor-group-id`]))}`,pathParams:{"monitor-group-id":String(t[`monitor-group-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.loadBalancers.monitorGroups.get({account_id:r,monitor_group_id:t[`monitor-group-id`]})),{successLabel:`Loaded`})}};function A(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`list`,describe:`List configured monitor groups.`,builder:A,handler:async t=>{if(t.dryRun){l({command:`cf load-balancers monitor-groups list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/load_balancers/monitor_groups`,pathParams:{},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.loadBalancers.monitorGroups.list({account_id:r})),{successLabel:`Loaded`})}};function M(e){return e.option(`monitor-group-id`,{type:`string`,description:`Monitor group ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const N={command:`list`,describe:`Get the list of resources that reference the provided monitor group.`,builder:M,handler:async t=>{if(t.dryRun){l({command:`cf load-balancers monitor-groups references list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/load_balancers/monitor_groups/${t[`monitor-group-id`]==null?`<monitor-group-id>`:encodeURIComponent(String(t[`monitor-group-id`]))}/references`,pathParams:{"monitor-group-id":String(t[`monitor-group-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.loadBalancers.monitorGroups.references.list({account_id:r,monitor_group_id:t[`monitor-group-id`]})),{successLabel:`Loaded`})}},P={command:`references`,describe:`List references to monitor groups used by load balancer pools`,builder:e=>e.command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function F(e){return e.positional(`monitor-group-id`,{type:`string`,description:`Monitor group ID`,demandOption:!0}).option(`description`,{type:`string`,description:`A short description of the monitor group`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const I={command:`update <monitor-group-id>`,describe:`Modify a configured monitor group.`,builder:F,handler:async n=>{if(n.dryRun){l({command:`cf load-balancers monitor-groups update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/load_balancers/monitor_groups/${n[`monitor-group-id`]==null?`<monitor-group-id>`:encodeURIComponent(String(n[`monitor-group-id`]))}`,pathParams:{"monitor-group-id":String(n[`monitor-group-id`]??``)},bodyKind:`json`,body:n.body===void 0?s({description:d(n.description,`description`,`text`)}):o(n.body)});return}let r=await a(n),p=n.local?f:await i(r);if(n.accountId=p,n.body){let e=o(n.body);c(await u(`Updating`,async()=>r.loadBalancers.monitorGroups.update({body:e,account_id:p,monitor_group_id:n[`monitor-group-id`]})),{successLabel:`Updated`});return}n.description===void 0&&(n.description=await t(`description`,`A short description of the monitor group`));let m=s({description:d(n.description,`description`,`text`)});c(await u(`Updating`,async()=>r.loadBalancers.monitorGroups.update({body:m,account_id:p,monitor_group_id:n[`monitor-group-id`]})),{successLabel:`Updated`})}},L={command:`monitor-groups`,describe:`Group monitors together for shared configuration and bulk management`,builder:e=>e.command(C).command(T).command(D).command(k).command(j).command(I).command(P).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function R(e){return e.option(`allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when monitor use HTTPS. This parameter is currently only valid for HTTP and HTTPS monitors.`,default:!1}).option(`consecutive-down`,{type:`number`,description:`To be marked unhealthy the monitored origin must fail this healthcheck N consecutive times.`}).option(`consecutive-up`,{type:`number`,description:`To be marked healthy the monitored origin must pass this healthcheck N consecutive times.`}).option(`description`,{type:`string`,description:`Object description.`,default:``}).option(`expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`expected-codes`,{type:`string`,description:`The expected HTTP response code or code range of the health check. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`follow-redirects`,{type:`boolean`,description:`Follow redirects if returned by the origin. This parameter is only valid for HTTP and HTTPS monitors.`,default:!1}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations.`,default:60}).option(`method`,{type:`string`,description:`The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' for TCP based health checks.`}).option(`path`,{type:`string`,description:`The endpoint path you want to conduct a health check against. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`port`,{type:`number`,description:`The port number to connect to for the health check. Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port when using a non-standard port (HTTP: default 80, HTTPS: default 443).`}).option(`probe-zone`,{type:`string`,description:`Assign this monitor to emulate the specified zone while probing. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`,default:2}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`,default:5}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'.`,choices:[`http`,`https`,`tcp`,`udp_icmp`,`icmp_ping`,`smtp`],default:`http`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const z={command:`create`,describe:`Create a configured monitor.`,builder:R,handler:async t=>{if(t.dryRun){l({command:`cf load-balancers monitors create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/load_balancers/monitors`,pathParams:{},bodyKind:`json`,body:t.body===void 0?s({allow_insecure:t[`allow-insecure`],consecutive_down:t[`consecutive-down`],consecutive_up:t[`consecutive-up`],description:d(t.description,`description`,`text`),expected_body:d(t[`expected-body`],`expected-body`,`text`),expected_codes:d(t[`expected-codes`],`expected-codes`,`text`),follow_redirects:t[`follow-redirects`],interval:t.interval,method:d(t.method,`method`,`text`),path:d(t.path,`path`,`text`),port:t.port,probe_zone:d(t[`probe-zone`],`probe-zone`,`text`),retries:t.retries,timeout:t.timeout,type:d(t.type,`type`,`text`)}):o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Creating`,async()=>n.loadBalancers.monitors.create({body:e,account_id:r})),{successLabel:`Created`});return}let p=s({allow_insecure:t[`allow-insecure`],consecutive_down:t[`consecutive-down`],consecutive_up:t[`consecutive-up`],description:d(t.description,`description`,`text`),expected_body:d(t[`expected-body`],`expected-body`,`text`),expected_codes:d(t[`expected-codes`],`expected-codes`,`text`),follow_redirects:t[`follow-redirects`],interval:t.interval,method:d(t.method,`method`,`text`),path:d(t.path,`path`,`text`),port:t.port,probe_zone:d(t[`probe-zone`],`probe-zone`,`text`),retries:t.retries,timeout:t.timeout,type:d(t.type,`type`,`text`)});c(await u(`Creating`,async()=>n.loadBalancers.monitors.create({body:p,account_id:r})),{successLabel:`Created`})}};function B(e){return e.positional(`monitor-id`,{type:`string`,description:`Monitor 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 V={command:`delete <monitor-id>`,describe:`Delete a configured monitor.`,builder:B,handler:async t=>{if(t.dryRun){l({command:`cf load-balancers monitors delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/load_balancers/monitors/${t[`monitor-id`]==null?`<monitor-id>`:encodeURIComponent(String(t[`monitor-id`]))}`,pathParams:{"monitor-id":String(t[`monitor-id`]??``)},bodyKind:`none`});return}let n=await a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force})){process.stderr.write(`Aborted.
5
- `);return}c(await u(`Deleting`,async()=>n.loadBalancers.monitors.delete({account_id:o,monitor_id:t[`monitor-id`]})),{successLabel:`Deleted`})}};function H(e){return e.positional(`monitor-id`,{type:`string`,description:`Monitor ID`,demandOption:!0}).option(`allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when monitor use HTTPS. This parameter is currently only valid for HTTP and HTTPS monitors.`}).option(`consecutive-down`,{type:`number`,description:`To be marked unhealthy the monitored origin must fail this healthcheck N consecutive times.`}).option(`consecutive-up`,{type:`number`,description:`To be marked healthy the monitored origin must pass this healthcheck N consecutive times.`}).option(`description`,{type:`string`,description:`Object description.`}).option(`expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`expected-codes`,{type:`string`,description:`The expected HTTP response code or code range of the health check. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`follow-redirects`,{type:`boolean`,description:`Follow redirects if returned by the origin. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations.`}).option(`method`,{type:`string`,description:`The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' for TCP based health checks.`}).option(`path`,{type:`string`,description:`The endpoint path you want to conduct a health check against. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`port`,{type:`number`,description:`The port number to connect to for the health check. Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port when using a non-standard port (HTTP: default 80, HTTPS: default 443).`}).option(`probe-zone`,{type:`string`,description:`Assign this monitor to emulate the specified zone while probing. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'.`,choices:[`http`,`https`,`tcp`,`udp_icmp`,`icmp_ping`,`smtp`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const U={command:`edit <monitor-id>`,describe:`Apply changes to an existing monitor, overwriting the supplied properties.`,builder:H,handler:async t=>{if(t.dryRun){l({command:`cf load-balancers monitors edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/load_balancers/monitors/${t[`monitor-id`]==null?`<monitor-id>`:encodeURIComponent(String(t[`monitor-id`]))}`,pathParams:{"monitor-id":String(t[`monitor-id`]??``)},bodyKind:`json`,body:t.body===void 0?s({allow_insecure:t[`allow-insecure`],consecutive_down:t[`consecutive-down`],consecutive_up:t[`consecutive-up`],description:d(t.description,`description`,`text`),expected_body:d(t[`expected-body`],`expected-body`,`text`),expected_codes:d(t[`expected-codes`],`expected-codes`,`text`),follow_redirects:t[`follow-redirects`],interval:t.interval,method:d(t.method,`method`,`text`),path:d(t.path,`path`,`text`),port:t.port,probe_zone:d(t[`probe-zone`],`probe-zone`,`text`),retries:t.retries,timeout:t.timeout,type:d(t.type,`type`,`text`)}):o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Updating`,async()=>n.loadBalancers.monitors.edit({body:e,account_id:r,monitor_id:t[`monitor-id`]})),{successLabel:`Updated`});return}let p=s({allow_insecure:t[`allow-insecure`],consecutive_down:t[`consecutive-down`],consecutive_up:t[`consecutive-up`],description:d(t.description,`description`,`text`),expected_body:d(t[`expected-body`],`expected-body`,`text`),expected_codes:d(t[`expected-codes`],`expected-codes`,`text`),follow_redirects:t[`follow-redirects`],interval:t.interval,method:d(t.method,`method`,`text`),path:d(t.path,`path`,`text`),port:t.port,probe_zone:d(t[`probe-zone`],`probe-zone`,`text`),retries:t.retries,timeout:t.timeout,type:d(t.type,`type`,`text`)});c(await u(`Updating`,async()=>n.loadBalancers.monitors.edit({body:p,account_id:r,monitor_id:t[`monitor-id`]})),{successLabel:`Updated`})}};function W(e){return e.positional(`monitor-id`,{type:`string`,description:`Monitor ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const G={command:`get <monitor-id>`,describe:`List a single configured monitor for an account.`,builder:W,handler:async t=>{if(t.dryRun){l({command:`cf load-balancers monitors get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/load_balancers/monitors/${t[`monitor-id`]==null?`<monitor-id>`:encodeURIComponent(String(t[`monitor-id`]))}`,pathParams:{"monitor-id":String(t[`monitor-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.loadBalancers.monitors.get({account_id:r,monitor_id:t[`monitor-id`]})),{successLabel:`Loaded`})}};function K(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const q={command:`list`,describe:`List configured monitors for an account.`,builder:K,handler:async t=>{if(t.dryRun){l({command:`cf load-balancers monitors list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/load_balancers/monitors`,pathParams:{},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.loadBalancers.monitors.list({account_id:r})),{successLabel:`Loaded`})}};function J(e){return e.positional(`monitor-id`,{type:`string`,description:`Monitor ID`,demandOption:!0}).option(`allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when monitor use HTTPS. This parameter is currently only valid for HTTP and HTTPS monitors.`,default:!1}).option(`consecutive-down`,{type:`number`,description:`To be marked unhealthy the monitored origin must fail this healthcheck N consecutive times.`}).option(`consecutive-up`,{type:`number`,description:`To be marked healthy the monitored origin must pass this healthcheck N consecutive times.`}).option(`description`,{type:`string`,description:`Object description.`,default:``}).option(`expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`expected-codes`,{type:`string`,description:`The expected HTTP response code or code range of the health check. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`follow-redirects`,{type:`boolean`,description:`Follow redirects if returned by the origin. This parameter is only valid for HTTP and HTTPS monitors.`,default:!1}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations.`,default:60}).option(`method`,{type:`string`,description:`The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' for TCP based health checks.`}).option(`path`,{type:`string`,description:`The endpoint path you want to conduct a health check against. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`port`,{type:`number`,description:`The port number to connect to for the health check. Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port when using a non-standard port (HTTP: default 80, HTTPS: default 443).`}).option(`probe-zone`,{type:`string`,description:`Assign this monitor to emulate the specified zone while probing. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`,default:2}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`,default:5}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'.`,choices:[`http`,`https`,`tcp`,`udp_icmp`,`icmp_ping`,`smtp`],default:`http`}).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 Y={command:`create <monitor-id>`,describe:`Preview pools using the specified monitor with provided monitor details. The returned preview_id can be used in the preview endpoint to retrieve the results.`,builder:J,handler:async t=>{if(t.dryRun){l({command:`cf load-balancers monitors previews create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/load_balancers/monitors/${t[`monitor-id`]==null?`<monitor-id>`:encodeURIComponent(String(t[`monitor-id`]))}/preview`,pathParams:{"monitor-id":String(t[`monitor-id`]??``)},bodyKind:`json`,body:t.body===void 0?s({allow_insecure:t[`allow-insecure`],consecutive_down:t[`consecutive-down`],consecutive_up:t[`consecutive-up`],description:d(t.description,`description`,`text`),expected_body:d(t[`expected-body`],`expected-body`,`text`),expected_codes:d(t[`expected-codes`],`expected-codes`,`text`),follow_redirects:t[`follow-redirects`],interval:t.interval,method:d(t.method,`method`,`text`),path:d(t.path,`path`,`text`),port:t.port,probe_zone:d(t[`probe-zone`],`probe-zone`,`text`),retries:t.retries,timeout:t.timeout,type:d(t.type,`type`,`text`)}):o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Creating`,async()=>n.loadBalancers.monitors.previews.create({body:e,account_id:r,monitor_id:t[`monitor-id`]})),{successLabel:`Created`});return}let p=s({allow_insecure:t[`allow-insecure`],consecutive_down:t[`consecutive-down`],consecutive_up:t[`consecutive-up`],description:d(t.description,`description`,`text`),expected_body:d(t[`expected-body`],`expected-body`,`text`),expected_codes:d(t[`expected-codes`],`expected-codes`,`text`),follow_redirects:t[`follow-redirects`],interval:t.interval,method:d(t.method,`method`,`text`),path:d(t.path,`path`,`text`),port:t.port,probe_zone:d(t[`probe-zone`],`probe-zone`,`text`),retries:t.retries,timeout:t.timeout,type:d(t.type,`type`,`text`)});c(await u(`Creating`,async()=>n.loadBalancers.monitors.previews.create({body:p,account_id:r,monitor_id:t[`monitor-id`]})),{successLabel:`Created`})}},X={command:`previews`,describe:`Health check configurations that probe origin servers and determine pool availability`,builder:e=>e.command(Y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Z(e){return e.positional(`monitor-id`,{type:`string`,description:`Monitor ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Q={command:`get <monitor-id>`,describe:`Get the list of resources that reference the provided monitor.`,builder:Z,handler:async t=>{if(t.dryRun){l({command:`cf load-balancers monitors references get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/load_balancers/monitors/${t[`monitor-id`]==null?`<monitor-id>`:encodeURIComponent(String(t[`monitor-id`]))}/references`,pathParams:{"monitor-id":String(t[`monitor-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.loadBalancers.monitors.references.get({account_id:r,monitor_id:t[`monitor-id`]})),{successLabel:`Loaded`})}},ne={command:`references`,describe:`Health check configurations that probe origin servers and determine pool availability`,builder:e=>e.command(Q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function re(e){return e.positional(`monitor-id`,{type:`string`,description:`Monitor ID`,demandOption:!0}).option(`allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when monitor use HTTPS. This parameter is currently only valid for HTTP and HTTPS monitors.`}).option(`consecutive-down`,{type:`number`,description:`To be marked unhealthy the monitored origin must fail this healthcheck N consecutive times.`}).option(`consecutive-up`,{type:`number`,description:`To be marked healthy the monitored origin must pass this healthcheck N consecutive times.`}).option(`description`,{type:`string`,description:`Object description.`}).option(`expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`expected-codes`,{type:`string`,description:`The expected HTTP response code or code range of the health check. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`follow-redirects`,{type:`boolean`,description:`Follow redirects if returned by the origin. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations.`}).option(`method`,{type:`string`,description:`The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' for TCP based health checks.`}).option(`path`,{type:`string`,description:`The endpoint path you want to conduct a health check against. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`port`,{type:`number`,description:`The port number to connect to for the health check. Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port when using a non-standard port (HTTP: default 80, HTTPS: default 443).`}).option(`probe-zone`,{type:`string`,description:`Assign this monitor to emulate the specified zone while probing. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'.`,choices:[`http`,`https`,`tcp`,`udp_icmp`,`icmp_ping`,`smtp`]}).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 ie={command:`update <monitor-id>`,describe:`Modify a configured monitor.`,builder:re,handler:async t=>{if(t.dryRun){l({command:`cf load-balancers monitors update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/load_balancers/monitors/${t[`monitor-id`]==null?`<monitor-id>`:encodeURIComponent(String(t[`monitor-id`]))}`,pathParams:{"monitor-id":String(t[`monitor-id`]??``)},bodyKind:`json`,body:t.body===void 0?s({allow_insecure:t[`allow-insecure`],consecutive_down:t[`consecutive-down`],consecutive_up:t[`consecutive-up`],description:d(t.description,`description`,`text`),expected_body:d(t[`expected-body`],`expected-body`,`text`),expected_codes:d(t[`expected-codes`],`expected-codes`,`text`),follow_redirects:t[`follow-redirects`],interval:t.interval,method:d(t.method,`method`,`text`),path:d(t.path,`path`,`text`),port:t.port,probe_zone:d(t[`probe-zone`],`probe-zone`,`text`),retries:t.retries,timeout:t.timeout,type:d(t.type,`type`,`text`)}):o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Updating`,async()=>n.loadBalancers.monitors.update({body:e,account_id:r,monitor_id:t[`monitor-id`]})),{successLabel:`Updated`});return}let p=s({allow_insecure:t[`allow-insecure`],consecutive_down:t[`consecutive-down`],consecutive_up:t[`consecutive-up`],description:d(t.description,`description`,`text`),expected_body:d(t[`expected-body`],`expected-body`,`text`),expected_codes:d(t[`expected-codes`],`expected-codes`,`text`),follow_redirects:t[`follow-redirects`],interval:t.interval,method:d(t.method,`method`,`text`),path:d(t.path,`path`,`text`),port:t.port,probe_zone:d(t[`probe-zone`],`probe-zone`,`text`),retries:t.retries,timeout:t.timeout,type:d(t.type,`type`,`text`)});c(await u(`Updating`,async()=>n.loadBalancers.monitors.update({body:p,account_id:r,monitor_id:t[`monitor-id`]})),{successLabel:`Updated`})}},ae={command:`monitors`,describe:`Health check configurations that probe origin servers and determine pool availability`,builder:e=>e.command(z).command(V).command(U).command(G).command(q).command(ie).command(X).command(ne).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function oe(e){return e.option(`notification-email`,{type:`string`,description:'The email address to send health status notifications to. This field is now deprecated in favor of Cloudflare Notifications for Load Balancing, so only resetting this field with an empty string `""` is accepted.'}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const se={command:`bulk-edit`,describe:"Apply changes to a number of existing pools, overwriting the supplied properties. Pools are ordered by ascending `name`. Returns the list of affected pools. Supports the standard pagination query parameters, either `limit`/`offset` or `per_page`/`page`.",builder:oe,handler:async t=>{if(t.dryRun){l({command:`cf load-balancers pools bulk-edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/load_balancers/pools`,pathParams:{},bodyKind:`json`,body:t.body===void 0?s({notification_email:d(t[`notification-email`],`notification-email`,`text`)}):o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Updating`,async()=>n.loadBalancers.pools.bulkEdit({body:e,account_id:r})),{successLabel:`Updated`});return}let p=s({notification_email:d(t[`notification-email`],`notification-email`,`text`)});c(await u(`Updating`,async()=>n.loadBalancers.pools.bulkEdit({body:p,account_id:r})),{successLabel:`Updated`})}};function ce(e){return e.option(`description`,{type:`string`,description:`A human-readable description of the pool.`,default:``}).option(`enabled`,{type:`boolean`,description:`Whether to enable (the default) or disable this pool. Disabled pools will not receive traffic and are excluded from health checks. Disabling a pool will cause any load balancers using it to failover to the next pool (if any).`,default:!0}).option(`latitude`,{type:`number`,description:`The latitude of the data center containing the origins used in this pool in decimal degrees. If this is set, longitude must also be set.`}).option(`load-shedding-default-percent`,{type:`number`,description:`The percent of traffic to shed from the pool, according to the default policy. Applies to new sessions and traffic without session affinity.`,default:0}).option(`load-shedding-default-policy`,{type:`string`,description:`The default policy to use when load shedding. A random policy randomly sheds a given percent of requests. A hash policy computes a hash over the CF-Connecting-IP address and sheds all requests originating from a percent of IPs.`,choices:[`random`,`hash`],default:`random`}).option(`load-shedding-session-percent`,{type:`number`,description:`The percent of existing sessions to shed from the pool, according to the session policy.`,default:0}).option(`load-shedding-session-policy`,{type:`string`,description:`Only the hash policy is supported for existing sessions (to avoid exponential decay).`,choices:[`hash`],default:`hash`}).option(`longitude`,{type:`number`,description:`The longitude of the data center containing the origins used in this pool in decimal degrees. If this is set, latitude must also be set.`}).option(`minimum-origins`,{type:`number`,description:`The minimum number of origins that must be healthy for this pool to serve traffic. If the number of healthy origins falls below this number, the pool will be marked unhealthy and will failover to the next available pool.`,default:1}).option(`monitor`,{type:`string`,description:`The ID of the Monitor to use for checking the health of origins within this pool.`}).option(`monitor-group`,{type:`string`,description:`The ID of the Monitor Group to use for checking the health of origins within this pool.`}).option(`name`,{type:`string`,description:`A short name (tag) for the pool. Only alphanumeric characters, hyphens, and underscores are allowed.`}).option(`notification-email`,{type:`string`,description:`This field is now deprecated. It has been moved to Cloudflare's Centralized Notification service https://developers.cloudflare.com/fundamentals/notifications/. The email address to send health status notifications to. This can be an individual mailbox or a mailing list. Multiple emails can be supplied as a comma delimited list.`,default:``}).option(`notification-filter-origin-disable`,{type:`boolean`,description:`If set true, disable notifications for this type of resource (pool or origin).`,default:!1}).option(`notification-filter-origin-healthy`,{type:`boolean`,description:`If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).`}).option(`notification-filter-pool-disable`,{type:`boolean`,description:`If set true, disable notifications for this type of resource (pool or origin).`,default:!1}).option(`notification-filter-pool-healthy`,{type:`boolean`,description:`If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).`}).option(`origin-steering-policy`,{type:`string`,description:'The type of origin steering policy to use.\n- `"random"`: Select an origin randomly.\n- `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP address.\n- `"least_outstanding_requests"`: Select an origin by taking into consideration origin weights, as well as each origin\'s number of outstanding requests. Origins with more pending requests are weighted proportionately less relative to others.\n- `"least_connections"`: Select an origin by taking into consideration origin weights, as well as each origin\'s number of open connections. Origins with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.',choices:[`random`,`hash`,`least_outstanding_requests`,`least_connections`],default:`random`}).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 le={command:`create`,describe:`Create a new pool.`,builder:ce,handler:async n=>{if(n.dryRun){l({command:`cf load-balancers pools create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/load_balancers/pools`,pathParams:{},bodyKind:`json`,body:n.body===void 0?s({description:d(n.description,`description`,`text`),enabled:n.enabled,latitude:n.latitude,load_shedding:{default_percent:n[`load-shedding-default-percent`],default_policy:d(n[`load-shedding-default-policy`],`load-shedding-default-policy`,`text`),session_percent:n[`load-shedding-session-percent`],session_policy:d(n[`load-shedding-session-policy`],`load-shedding-session-policy`,`text`)},longitude:n.longitude,minimum_origins:n[`minimum-origins`],monitor:d(n.monitor,`monitor`,`text`),monitor_group:d(n[`monitor-group`],`monitor-group`,`text`),name:d(n.name,`name`,`text`),notification_email:d(n[`notification-email`],`notification-email`,`text`),notification_filter:{origin:{disable:n[`notification-filter-origin-disable`],healthy:n[`notification-filter-origin-healthy`]},pool:{disable:n[`notification-filter-pool-disable`],healthy:n[`notification-filter-pool-healthy`]}},origin_steering:{policy:d(n[`origin-steering-policy`],`origin-steering-policy`,`text`)}}):o(n.body)});return}let r=await a(n),p=n.local?f:await i(r);if(n.accountId=p,n.body){let e=o(n.body);c(await u(`Creating`,async()=>r.loadBalancers.pools.create({...e,account_id:p})),{successLabel:`Created`});return}n.name===void 0&&(n.name=await t(`name`,`A short name (tag) for the pool. Only alphanumeric characters, hyphens, and underscores are allowed.`));let m=s({description:d(n.description,`description`,`text`),enabled:n.enabled,latitude:n.latitude,load_shedding:{default_percent:n[`load-shedding-default-percent`],default_policy:d(n[`load-shedding-default-policy`],`load-shedding-default-policy`,`text`),session_percent:n[`load-shedding-session-percent`],session_policy:d(n[`load-shedding-session-policy`],`load-shedding-session-policy`,`text`)},longitude:n.longitude,minimum_origins:n[`minimum-origins`],monitor:d(n.monitor,`monitor`,`text`),monitor_group:d(n[`monitor-group`],`monitor-group`,`text`),name:d(n.name,`name`,`text`),notification_email:d(n[`notification-email`],`notification-email`,`text`),notification_filter:{origin:{disable:n[`notification-filter-origin-disable`],healthy:n[`notification-filter-origin-healthy`]},pool:{disable:n[`notification-filter-pool-disable`],healthy:n[`notification-filter-pool-healthy`]}},origin_steering:{policy:d(n[`origin-steering-policy`],`origin-steering-policy`,`text`)}});c(await u(`Creating`,async()=>r.loadBalancers.pools.create({...m,account_id:p})),{successLabel:`Created`})}};function ue(e){return e.positional(`pool-id`,{type:`string`,description:`Pool 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 de={command:`delete <pool-id>`,describe:`Delete a configured pool.`,builder:ue,handler:async t=>{if(t.dryRun){l({command:`cf load-balancers pools delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/load_balancers/pools/${t[`pool-id`]==null?`<pool-id>`:encodeURIComponent(String(t[`pool-id`]))}`,pathParams:{"pool-id":String(t[`pool-id`]??``)},bodyKind:`none`});return}let n=await a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force})){process.stderr.write(`Aborted.
6
- `);return}c(await u(`Deleting`,async()=>n.loadBalancers.pools.delete({account_id:o,pool_id:t[`pool-id`]})),{successLabel:`Deleted`})}};function fe(e){return e.positional(`pool-id`,{type:`string`,description:`Pool ID`,demandOption:!0}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means every Cloudflare data center.`}).option(`description`,{type:`string`,description:`A human-readable description of the pool.`}).option(`enabled`,{type:`boolean`,description:`Whether to enable (the default) or disable this pool. Disabled pools will not receive traffic and are excluded from health checks. Disabling a pool will cause any load balancers using it to failover to the next pool (if any).`}).option(`latitude`,{type:`number`,description:`The latitude of the data center containing the origins used in this pool in decimal degrees. If this is set, longitude must also be set.`}).option(`load-shedding-default-percent`,{type:`number`,description:`The percent of traffic to shed from the pool, according to the default policy. Applies to new sessions and traffic without session affinity.`}).option(`load-shedding-default-policy`,{type:`string`,description:`The default policy to use when load shedding. A random policy randomly sheds a given percent of requests. A hash policy computes a hash over the CF-Connecting-IP address and sheds all requests originating from a percent of IPs.`,choices:[`random`,`hash`]}).option(`load-shedding-session-percent`,{type:`number`,description:`The percent of existing sessions to shed from the pool, according to the session policy.`}).option(`load-shedding-session-policy`,{type:`string`,description:`Only the hash policy is supported for existing sessions (to avoid exponential decay).`,choices:[`hash`]}).option(`longitude`,{type:`number`,description:`The longitude of the data center containing the origins used in this pool in decimal degrees. If this is set, latitude must also be set.`}).option(`minimum-origins`,{type:`number`,description:`The minimum number of origins that must be healthy for this pool to serve traffic. If the number of healthy origins falls below this number, the pool will be marked unhealthy and will failover to the next available pool.`}).option(`monitor`,{type:`string`,description:`The ID of the Monitor to use for checking the health of origins within this pool.`}).option(`monitor-group`,{type:`string`,description:`The ID of the Monitor Group to use for checking the health of origins within this pool.`}).option(`name`,{type:`string`,description:`A short name (tag) for the pool. Only alphanumeric characters, hyphens, and underscores are allowed.`}).option(`notification-email`,{type:`string`,description:`This field is now deprecated. It has been moved to Cloudflare's Centralized Notification service https://developers.cloudflare.com/fundamentals/notifications/. The email address to send health status notifications to. This can be an individual mailbox or a mailing list. Multiple emails can be supplied as a comma delimited list.`}).option(`notification-filter-origin-disable`,{type:`boolean`,description:`If set true, disable notifications for this type of resource (pool or origin).`}).option(`notification-filter-origin-healthy`,{type:`boolean`,description:`If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).`}).option(`notification-filter-pool-disable`,{type:`boolean`,description:`If set true, disable notifications for this type of resource (pool or origin).`}).option(`notification-filter-pool-healthy`,{type:`boolean`,description:`If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).`}).option(`origin-steering-policy`,{type:`string`,description:'The type of origin steering policy to use.\n- `"random"`: Select an origin randomly.\n- `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP address.\n- `"least_outstanding_requests"`: Select an origin by taking into consideration origin weights, as well as each origin\'s number of outstanding requests. Origins with more pending requests are weighted proportionately less relative to others.\n- `"least_connections"`: Select an origin by taking into consideration origin weights, as well as each origin\'s number of open connections. Origins with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.',choices:[`random`,`hash`,`least_outstanding_requests`,`least_connections`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const pe={command:`edit <pool-id>`,describe:`Apply changes to an existing pool, overwriting the supplied properties.`,builder:fe,handler:async t=>{if(t.dryRun){l({command:`cf load-balancers pools edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/load_balancers/pools/${t[`pool-id`]==null?`<pool-id>`:encodeURIComponent(String(t[`pool-id`]))}`,pathParams:{"pool-id":String(t[`pool-id`]??``)},bodyKind:`json`,body:t.body===void 0?s({check_regions:t[`check-regions`],description:d(t.description,`description`,`text`),enabled:t.enabled,latitude:t.latitude,load_shedding:{default_percent:t[`load-shedding-default-percent`],default_policy:d(t[`load-shedding-default-policy`],`load-shedding-default-policy`,`text`),session_percent:t[`load-shedding-session-percent`],session_policy:d(t[`load-shedding-session-policy`],`load-shedding-session-policy`,`text`)},longitude:t.longitude,minimum_origins:t[`minimum-origins`],monitor:d(t.monitor,`monitor`,`text`),monitor_group:d(t[`monitor-group`],`monitor-group`,`text`),name:d(t.name,`name`,`text`),notification_email:d(t[`notification-email`],`notification-email`,`text`),notification_filter:{origin:{disable:t[`notification-filter-origin-disable`],healthy:t[`notification-filter-origin-healthy`]},pool:{disable:t[`notification-filter-pool-disable`],healthy:t[`notification-filter-pool-healthy`]}},origin_steering:{policy:d(t[`origin-steering-policy`],`origin-steering-policy`,`text`)}}):o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Updating`,async()=>n.loadBalancers.pools.edit({...e,account_id:r,pool_id:t[`pool-id`]})),{successLabel:`Updated`});return}let p=s({check_regions:t[`check-regions`],description:d(t.description,`description`,`text`),enabled:t.enabled,latitude:t.latitude,load_shedding:{default_percent:t[`load-shedding-default-percent`],default_policy:d(t[`load-shedding-default-policy`],`load-shedding-default-policy`,`text`),session_percent:t[`load-shedding-session-percent`],session_policy:d(t[`load-shedding-session-policy`],`load-shedding-session-policy`,`text`)},longitude:t.longitude,minimum_origins:t[`minimum-origins`],monitor:d(t.monitor,`monitor`,`text`),monitor_group:d(t[`monitor-group`],`monitor-group`,`text`),name:d(t.name,`name`,`text`),notification_email:d(t[`notification-email`],`notification-email`,`text`),notification_filter:{origin:{disable:t[`notification-filter-origin-disable`],healthy:t[`notification-filter-origin-healthy`]},pool:{disable:t[`notification-filter-pool-disable`],healthy:t[`notification-filter-pool-healthy`]}},origin_steering:{policy:d(t[`origin-steering-policy`],`origin-steering-policy`,`text`)}});c(await u(`Updating`,async()=>n.loadBalancers.pools.edit({...p,account_id:r,pool_id:t[`pool-id`]})),{successLabel:`Updated`})}};function me(e){return e.positional(`pool-id`,{type:`string`,description:`Pool ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const he={command:`get <pool-id>`,describe:`Fetch a single configured pool.`,builder:me,handler:async t=>{if(t.dryRun){l({command:`cf load-balancers pools get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/load_balancers/pools/${t[`pool-id`]==null?`<pool-id>`:encodeURIComponent(String(t[`pool-id`]))}`,pathParams:{"pool-id":String(t[`pool-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.loadBalancers.pools.get({account_id:r,pool_id:t[`pool-id`]})),{successLabel:`Loaded`})}};function ge(e){return e.positional(`pool-id`,{type:`string`,description:`Pool ID`,demandOption:!0}).option(`allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when monitor use HTTPS. This parameter is currently only valid for HTTP and HTTPS monitors.`,default:!1}).option(`consecutive-down`,{type:`number`,description:`To be marked unhealthy the monitored origin must fail this healthcheck N consecutive times.`}).option(`consecutive-up`,{type:`number`,description:`To be marked healthy the monitored origin must pass this healthcheck N consecutive times.`}).option(`description`,{type:`string`,description:`Object description.`,default:``}).option(`expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`expected-codes`,{type:`string`,description:`The expected HTTP response code or code range of the health check. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`follow-redirects`,{type:`boolean`,description:`Follow redirects if returned by the origin. This parameter is only valid for HTTP and HTTPS monitors.`,default:!1}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations.`,default:60}).option(`method`,{type:`string`,description:`The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' for TCP based health checks.`}).option(`path`,{type:`string`,description:`The endpoint path you want to conduct a health check against. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`port`,{type:`number`,description:`The port number to connect to for the health check. Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port when using a non-standard port (HTTP: default 80, HTTPS: default 443).`}).option(`probe-zone`,{type:`string`,description:`Assign this monitor to emulate the specified zone while probing. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`,default:2}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`,default:5}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'.`,choices:[`http`,`https`,`tcp`,`udp_icmp`,`icmp_ping`,`smtp`],default:`http`}).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 _e={command:`create <pool-id>`,describe:`Preview pool health using provided monitor details. The returned preview_id can be used in the preview endpoint to retrieve the results.`,builder:ge,handler:async t=>{if(t.dryRun){l({command:`cf load-balancers pools health create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/load_balancers/pools/${t[`pool-id`]==null?`<pool-id>`:encodeURIComponent(String(t[`pool-id`]))}/preview`,pathParams:{"pool-id":String(t[`pool-id`]??``)},bodyKind:`json`,body:t.body===void 0?s({allow_insecure:t[`allow-insecure`],consecutive_down:t[`consecutive-down`],consecutive_up:t[`consecutive-up`],description:d(t.description,`description`,`text`),expected_body:d(t[`expected-body`],`expected-body`,`text`),expected_codes:d(t[`expected-codes`],`expected-codes`,`text`),follow_redirects:t[`follow-redirects`],interval:t.interval,method:d(t.method,`method`,`text`),path:d(t.path,`path`,`text`),port:t.port,probe_zone:d(t[`probe-zone`],`probe-zone`,`text`),retries:t.retries,timeout:t.timeout,type:d(t.type,`type`,`text`)}):o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Creating`,async()=>n.loadBalancers.pools.health.create({body:e,account_id:r,pool_id:t[`pool-id`]})),{successLabel:`Created`});return}let p=s({allow_insecure:t[`allow-insecure`],consecutive_down:t[`consecutive-down`],consecutive_up:t[`consecutive-up`],description:d(t.description,`description`,`text`),expected_body:d(t[`expected-body`],`expected-body`,`text`),expected_codes:d(t[`expected-codes`],`expected-codes`,`text`),follow_redirects:t[`follow-redirects`],interval:t.interval,method:d(t.method,`method`,`text`),path:d(t.path,`path`,`text`),port:t.port,probe_zone:d(t[`probe-zone`],`probe-zone`,`text`),retries:t.retries,timeout:t.timeout,type:d(t.type,`type`,`text`)});c(await u(`Creating`,async()=>n.loadBalancers.pools.health.create({body:p,account_id:r,pool_id:t[`pool-id`]})),{successLabel:`Created`})}};function ve(e){return e.positional(`pool-id`,{type:`string`,description:`Pool ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ye={command:`get <pool-id>`,describe:`Fetch the latest pool health status for a single pool.`,builder:ve,handler:async t=>{if(t.dryRun){l({command:`cf load-balancers pools health get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/load_balancers/pools/${t[`pool-id`]==null?`<pool-id>`:encodeURIComponent(String(t[`pool-id`]))}/health`,pathParams:{"pool-id":String(t[`pool-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.loadBalancers.pools.health.get({account_id:r,pool_id:t[`pool-id`]})),{successLabel:`Loaded`})}},be={command:`health`,describe:`Origin server pools with weighted traffic distribution, health thresholds, and geographic preferences`,builder:e=>e.command(_e).command(ye).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function xe(e){return e.option(`monitor`,{type:`string`,description:`The ID of the Monitor to use for checking the health of origins within this pool.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Se={command:`list`,describe:`List configured pools.`,builder:xe,handler:async t=>{let n={monitor:t.monitor};if(t.dryRun){l({command:`cf load-balancers pools list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/load_balancers/pools`,pathParams:{},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.loadBalancers.pools.list({account_id:o,...n})),{successLabel:`Loaded`})}};function Ce(e){return e.positional(`pool-id`,{type:`string`,description:`Pool ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const we={command:`get <pool-id>`,describe:`Get the list of resources that reference the provided pool.`,builder:Ce,handler:async t=>{if(t.dryRun){l({command:`cf load-balancers pools references get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/load_balancers/pools/${t[`pool-id`]==null?`<pool-id>`:encodeURIComponent(String(t[`pool-id`]))}/references`,pathParams:{"pool-id":String(t[`pool-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.loadBalancers.pools.references.get({account_id:r,pool_id:t[`pool-id`]})),{successLabel:`Loaded`})}},Te={command:`references`,describe:`Origin server pools with weighted traffic distribution, health thresholds, and geographic preferences`,builder:e=>e.command(we).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ee(e){return e.positional(`pool-id`,{type:`string`,description:`Pool ID`,demandOption:!0}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means every Cloudflare data center.`}).option(`description`,{type:`string`,description:`A human-readable description of the pool.`}).option(`enabled`,{type:`boolean`,description:`Whether to enable (the default) or disable this pool. Disabled pools will not receive traffic and are excluded from health checks. Disabling a pool will cause any load balancers using it to failover to the next pool (if any).`}).option(`latitude`,{type:`number`,description:`The latitude of the data center containing the origins used in this pool in decimal degrees. If this is set, longitude must also be set.`}).option(`load-shedding-default-percent`,{type:`number`,description:`The percent of traffic to shed from the pool, according to the default policy. Applies to new sessions and traffic without session affinity.`}).option(`load-shedding-default-policy`,{type:`string`,description:`The default policy to use when load shedding. A random policy randomly sheds a given percent of requests. A hash policy computes a hash over the CF-Connecting-IP address and sheds all requests originating from a percent of IPs.`,choices:[`random`,`hash`]}).option(`load-shedding-session-percent`,{type:`number`,description:`The percent of existing sessions to shed from the pool, according to the session policy.`}).option(`load-shedding-session-policy`,{type:`string`,description:`Only the hash policy is supported for existing sessions (to avoid exponential decay).`,choices:[`hash`]}).option(`longitude`,{type:`number`,description:`The longitude of the data center containing the origins used in this pool in decimal degrees. If this is set, latitude must also be set.`}).option(`minimum-origins`,{type:`number`,description:`The minimum number of origins that must be healthy for this pool to serve traffic. If the number of healthy origins falls below this number, the pool will be marked unhealthy and will failover to the next available pool.`}).option(`monitor`,{type:`string`,description:`The ID of the Monitor to use for checking the health of origins within this pool.`}).option(`monitor-group`,{type:`string`,description:`The ID of the Monitor Group to use for checking the health of origins within this pool.`}).option(`name`,{type:`string`,description:`A short name (tag) for the pool. Only alphanumeric characters, hyphens, and underscores are allowed.`}).option(`notification-email`,{type:`string`,description:`This field is now deprecated. It has been moved to Cloudflare's Centralized Notification service https://developers.cloudflare.com/fundamentals/notifications/. The email address to send health status notifications to. This can be an individual mailbox or a mailing list. Multiple emails can be supplied as a comma delimited list.`}).option(`notification-filter-origin-disable`,{type:`boolean`,description:`If set true, disable notifications for this type of resource (pool or origin).`}).option(`notification-filter-origin-healthy`,{type:`boolean`,description:`If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).`}).option(`notification-filter-pool-disable`,{type:`boolean`,description:`If set true, disable notifications for this type of resource (pool or origin).`}).option(`notification-filter-pool-healthy`,{type:`boolean`,description:`If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).`}).option(`origin-steering-policy`,{type:`string`,description:'The type of origin steering policy to use.\n- `"random"`: Select an origin randomly.\n- `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP address.\n- `"least_outstanding_requests"`: Select an origin by taking into consideration origin weights, as well as each origin\'s number of outstanding requests. Origins with more pending requests are weighted proportionately less relative to others.\n- `"least_connections"`: Select an origin by taking into consideration origin weights, as well as each origin\'s number of open connections. Origins with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.',choices:[`random`,`hash`,`least_outstanding_requests`,`least_connections`]}).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 De={command:`update <pool-id>`,describe:`Modify a configured pool.`,builder:Ee,handler:async n=>{if(n.dryRun){l({command:`cf load-balancers pools update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/load_balancers/pools/${n[`pool-id`]==null?`<pool-id>`:encodeURIComponent(String(n[`pool-id`]))}`,pathParams:{"pool-id":String(n[`pool-id`]??``)},bodyKind:`json`,body:n.body===void 0?s({check_regions:n[`check-regions`],description:d(n.description,`description`,`text`),enabled:n.enabled,latitude:n.latitude,load_shedding:{default_percent:n[`load-shedding-default-percent`],default_policy:d(n[`load-shedding-default-policy`],`load-shedding-default-policy`,`text`),session_percent:n[`load-shedding-session-percent`],session_policy:d(n[`load-shedding-session-policy`],`load-shedding-session-policy`,`text`)},longitude:n.longitude,minimum_origins:n[`minimum-origins`],monitor:d(n.monitor,`monitor`,`text`),monitor_group:d(n[`monitor-group`],`monitor-group`,`text`),name:d(n.name,`name`,`text`),notification_email:d(n[`notification-email`],`notification-email`,`text`),notification_filter:{origin:{disable:n[`notification-filter-origin-disable`],healthy:n[`notification-filter-origin-healthy`]},pool:{disable:n[`notification-filter-pool-disable`],healthy:n[`notification-filter-pool-healthy`]}},origin_steering:{policy:d(n[`origin-steering-policy`],`origin-steering-policy`,`text`)}}):o(n.body)});return}let r=await a(n),p=n.local?f:await i(r);if(n.accountId=p,n.body){let e=o(n.body);c(await u(`Updating`,async()=>r.loadBalancers.pools.update({...e,account_id:p,pool_id:n[`pool-id`]})),{successLabel:`Updated`});return}n.name===void 0&&(n.name=await t(`name`,`A short name (tag) for the pool. Only alphanumeric characters, hyphens, and underscores are allowed.`));let m=s({check_regions:n[`check-regions`],description:d(n.description,`description`,`text`),enabled:n.enabled,latitude:n.latitude,load_shedding:{default_percent:n[`load-shedding-default-percent`],default_policy:d(n[`load-shedding-default-policy`],`load-shedding-default-policy`,`text`),session_percent:n[`load-shedding-session-percent`],session_policy:d(n[`load-shedding-session-policy`],`load-shedding-session-policy`,`text`)},longitude:n.longitude,minimum_origins:n[`minimum-origins`],monitor:d(n.monitor,`monitor`,`text`),monitor_group:d(n[`monitor-group`],`monitor-group`,`text`),name:d(n.name,`name`,`text`),notification_email:d(n[`notification-email`],`notification-email`,`text`),notification_filter:{origin:{disable:n[`notification-filter-origin-disable`],healthy:n[`notification-filter-origin-healthy`]},pool:{disable:n[`notification-filter-pool-disable`],healthy:n[`notification-filter-pool-healthy`]}},origin_steering:{policy:d(n[`origin-steering-policy`],`origin-steering-policy`,`text`)}});c(await u(`Updating`,async()=>r.loadBalancers.pools.update({...m,account_id:p,pool_id:n[`pool-id`]})),{successLabel:`Updated`})}},Oe={command:`pools`,describe:`Origin server pools with weighted traffic distribution, health thresholds, and geographic preferences`,builder:e=>e.command(se).command(le).command(de).command(pe).command(he).command(Se).command(De).command(be).command(Te).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ke(e){return e.positional(`preview-id`,{type:`string`,description:`Preview ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ae={command:`get <preview-id>`,describe:`Get the result of a previous preview operation using the provided preview_id.`,builder:ke,handler:async t=>{if(t.dryRun){l({command:`cf load-balancers previews get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/load_balancers/preview/${t[`preview-id`]==null?`<preview-id>`:encodeURIComponent(String(t[`preview-id`]))}`,pathParams:{"preview-id":String(t[`preview-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.loadBalancers.previews.get({account_id:r,preview_id:t[`preview-id`]})),{successLabel:`Loaded`})}},je={command:`previews`,describe:`Preview the result of a health check monitor configuration before applying it`,builder:e=>e.command(Ae).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Me(e){return e.positional(`region-id`,{type:`string`,description:`A list of Cloudflare regions. WNAM: Western North America, ENAM: Eastern North America, WEU: Western Europe, EEU: Eastern Europe, NSAM: Northern South America, SSAM: Southern South America, OC: Oceania, ME: Middle East, NAF: North Africa, SAF: South Africa, SAS: Southern Asia, SEAS: South East Asia, NEAS: North East Asia).`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ne={command:`get <region-id>`,describe:`Get a single region mapping.`,builder:p(Me),handler:async t=>{if(t.dryRun){l({command:`cf load-balancers regions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/load_balancers/regions/${t[`region-id`]==null?`<region-id>`:encodeURIComponent(String(t[`region-id`]))}`,pathParams:{"region-id":String(t[`region-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.loadBalancers.regions.get({account_id:r,region_id:t[`region-id`]})),{successLabel:`Loaded`})}};function Pe(e){return e.option(`subdivision-code`,{type:`string`,description:`Two-letter subdivision code followed in ISO 3166-2.`}).option(`subdivision-code-a2`,{type:`string`,description:`Two-letter subdivision code followed in ISO 3166-2.`}).option(`country-code-a2`,{type:`string`,description:`Two-letter alpha-2 country code followed in ISO 3166-1.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $={command:`list`,describe:`List all region mappings.`,builder:Pe,handler:async t=>{let n={subdivision_code:t[`subdivision-code`],subdivision_code_a2:t[`subdivision-code-a2`],country_code_a2:t[`country-code-a2`]};if(t.dryRun){l({command:`cf load-balancers regions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/load_balancers/regions`,pathParams:{},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.loadBalancers.regions.list({account_id:o,...n})),{successLabel:`Loaded`})}},Fe={command:`regions`,describe:`Geographic regions used for regional pool steering and traffic policies`,builder:e=>e.command(Ne).command($).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ie(e){return e.option(`query`,{type:`string`,description:`Search query term.`}).option(`references`,{type:`string`,description:`The type of references to include. "*" to include both referral and referrer references. "" to not include any reference information.`,choices:[``,`*`,`referral`,`referrer`]}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Le={command:`list`,describe:`Search for Load Balancing resources.`,builder:p(Ie),handler:async t=>{let n={query:t.query,references:t.references,page:t.page,per_page:t[`per-page`]};if(t.dryRun){l({command:`cf load-balancers searches list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/load_balancers/search`,pathParams:{},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.loadBalancers.searches.list({account_id:o,...n})),{successLabel:`Loaded`})}},Re={command:`searches`,describe:`Search across all load balancer resources (pools, monitors, load balancers) by name or reference`,builder:e=>e.command(Le).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ze(e){return e.positional(`load-balancer-id`,{type:`string`,description:`Load balancer ID`,demandOption:!0}).option(`adaptive-routing-failover-across-pools`,{type:`boolean`,description:"Extends zero-downtime failover of requests to healthy origins from alternate pools, when no healthy alternate exists in the same pool, according to the failover order defined by traffic and origin steering. When set false (the default) zero-downtime failover will only occur between origins within the same pool. See `session_affinity_attributes` for control over when sessions are broken or reassigned."}).option(`default-pools`,{type:`string`,array:!0,description:`A list of pool IDs ordered by their failover priority. Pools defined here are used by default, or when region_pools are not configured for a given region.`}).option(`description`,{type:`string`,description:`Object description.`}).option(`enabled`,{type:`boolean`,description:`Whether to enable (the default) this load balancer.`}).option(`fallback-pool`,{type:`string`,description:`The pool ID to use when all other pools are detected as unhealthy.`}).option(`location-strategy-mode`,{type:`string`,description:'Determines the authoritative location when ECS is not preferred, does not exist in the request, or its GeoIP lookup is unsuccessful.\n- `"pop"`: Use the Cloudflare PoP location.\n- `"resolver_ip"`: Use the DNS resolver GeoIP location. If the GeoIP lookup is unsuccessful, use the Cloudflare PoP location.',choices:[`pop`,`resolver_ip`]}).option(`location-strategy-prefer-ecs`,{type:`string`,description:'Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the authoritative location.\n- `"always"`: Always prefer ECS.\n- `"never"`: Never prefer ECS.\n- `"proximity"`: Prefer ECS only when `steering_policy="proximity"`.\n- `"geo"`: Prefer ECS only when `steering_policy="geo"`.',choices:[`always`,`never`,`proximity`,`geo`]}).option(`name`,{type:`string`,description:`The DNS hostname to associate with your Load Balancer. If this hostname already exists as a DNS record in Cloudflare's DNS, the Load Balancer will take precedence and the DNS record will not be used.`}).option(`networks`,{type:`string`,array:!0,description:`List of networks where Load Balancer or Pool is enabled.`}).option(`proxied`,{type:`boolean`,description:`Whether the hostname should be gray clouded (false) or orange clouded (true).`}).option(`random-steering-default-weight`,{type:`number`,description:`The default weight for pools in the load balancer that are not specified in the pool_weights map.`}).option(`session-affinity`,{type:`string`,description:'Specifies the type of session affinity the load balancer should use unless specified as `"none"`. The supported types are: - `"cookie"`: On the first request to a proxied load balancer, a cookie is generated, encoding information of which origin the request will be forwarded to. Subsequent requests, by the same client to the same load balancer, will be sent to the origin server the cookie encodes, for the duration of the cookie and as long as the origin server remains healthy. If the cookie has expired or the origin server is unhealthy, then a new origin server is calculated and used. - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin selection is stable and based on the client\'s ip address. - `"header"`: On the first request to a proxied load balancer, a session key based on the configured HTTP headers (see `session_affinity_attributes.headers`) is generated, encoding the request headers used for storing in the load balancer session state which origin the request will be forwarded to. Subsequent requests to the load balancer with the same headers will be sent to the same origin server, for the duration of the session and as long as the origin server remains healthy. If the session has been idle for the duration of `session_affinity_ttl` seconds or the origin server is unhealthy, then a new origin server is calculated and used. See `headers` in `session_affinity_attributes` for additional required configuration.',choices:[`none`,`cookie`,`ip_cookie`,`header`]}).option(`session-affinity-attributes-drain-duration`,{type:`number`,description:`Configures the drain duration in seconds. This field is only used when session affinity is enabled on the load balancer.`}).option(`session-affinity-attributes-headers`,{type:`string`,array:!0,description:'Configures the names of HTTP headers to base session affinity on when header `session_affinity` is enabled. At least one HTTP header name must be provided. To specify the exact cookies to be used, include an item in the following format: `"cookie:<cookie-name-1>,<cookie-name-2>"` (example) where everything after the colon is a comma-separated list of cookie names. Providing only `"cookie"` will result in all cookies being used. The default max number of HTTP header names that can be provided depends on your plan: 5 for Enterprise, 1 for all other plans.'}).option(`session-affinity-attributes-require-all-headers`,{type:`boolean`,description:'When header `session_affinity` is enabled, this option can be used to specify how HTTP headers on load balancing requests will be used. The supported values are: - `"true"`: Load balancing requests must contain *all* of the HTTP headers specified by the `headers` session affinity attribute, otherwise sessions aren\'t created. - `"false"`: Load balancing requests must contain *at least one* of the HTTP headers specified by the `headers` session affinity attribute, otherwise sessions aren\'t created.'}).option(`session-affinity-attributes-samesite`,{type:`string`,description:`Configures the SameSite attribute on session affinity cookie. Value "Auto" will be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: when using value "None", the secure attribute can not be set to "Never".`,choices:[`Auto`,`Lax`,`None`,`Strict`]}).option(`session-affinity-attributes-secure`,{type:`string`,description:`Configures the Secure attribute on session affinity cookie. Value "Always" indicates the Secure attribute will be set in the Set-Cookie header, "Never" indicates the Secure attribute will not be set, and "Auto" will set the Secure attribute depending if Always Use HTTPS is enabled.`,choices:[`Auto`,`Always`,`Never`]}).option(`session-affinity-attributes-zero-downtime-failover`,{type:`string`,description:'Configures the zero-downtime failover between origins within a pool when session affinity is enabled. This feature is currently incompatible with Argo, Tiered Cache, and Bandwidth Alliance. The supported values are: - `"none"`: No failover takes place for sessions pinned to the origin (default). - `"temporary"`: Traffic will be sent to another other healthy origin until the originally pinned origin is available; note that this can potentially result in heavy origin flapping. - `"sticky"`: The session affinity cookie is updated and subsequent requests are sent to the new origin. Note: Zero-downtime failover with sticky sessions is currently not supported for session affinity by header.',choices:[`none`,`temporary`,`sticky`]}).option(`session-affinity-ttl`,{type:`number`,description:'Time, in seconds, until a client\'s session expires after being created. Once the expiry time has been reached, subsequent requests may get sent to a different origin server. The accepted ranges per `session_affinity` policy are: - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used unless explicitly set. The accepted range of values is between [1800, 604800]. - `"header"`: The current default of 1800 seconds will be used unless explicitly set. The accepted range of values is between [30, 3600]. Note: With session affinity by header, sessions only expire after they haven\'t been used for the number of seconds specified.'}).option(`steering-policy`,{type:`string`,description:'Steering Policy for this load balancer.\n- `"off"`: Use `default_pools`.\n- `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied requests, the country for `country_pools` is determined by `location_strategy`.\n- `"random"`: Select a pool randomly.\n- `"dynamic_latency"`: Use round trip time to select the closest pool in default_pools (requires pool health checks).\n- `"proximity"`: Use the pools\' latitude and longitude to select the closest pool using the Cloudflare PoP location for proxied requests or the location determined by `location_strategy` for non-proxied requests.\n- `"least_outstanding_requests"`: Select a pool by taking into consideration `random_steering` weights, as well as each pool\'s number of outstanding requests. Pools with more pending requests are weighted proportionately less relative to others.\n- `"least_connections"`: Select a pool by taking into consideration `random_steering` weights, as well as each pool\'s number of open connections. Pools with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.\n- `""`: Will map to `"geo"` if you use `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`.',choices:[`off`,`geo`,`random`,`dynamic_latency`,`proximity`,`least_outstanding_requests`,`least_connections`]}).option(`ttl`,{type:`number`,description:`Time to live (TTL) of the DNS entry for the IP address returned by this load balancer. This only applies to gray-clouded (unproxied) load balancers.`}).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 Be={command:`update <load-balancer-id>`,describe:`Update a configured load balancer.`,builder:ze,handler:async e=>{if(e.dryRun){l({command:`cf load-balancers update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/load_balancers/${e[`load-balancer-id`]==null?`<load-balancer-id>`:encodeURIComponent(String(e[`load-balancer-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"load-balancer-id":String(e[`load-balancer-id`]??``)},bodyKind:`json`,body:e.body===void 0?s({adaptive_routing:{failover_across_pools:e[`adaptive-routing-failover-across-pools`]},default_pools:e[`default-pools`],description:d(e.description,`description`,`text`),enabled:e.enabled,fallback_pool:d(e[`fallback-pool`],`fallback-pool`,`text`),location_strategy:{mode:d(e[`location-strategy-mode`],`location-strategy-mode`,`text`),prefer_ecs:d(e[`location-strategy-prefer-ecs`],`location-strategy-prefer-ecs`,`text`)},name:d(e.name,`name`,`text`),networks:e.networks,proxied:e.proxied,random_steering:{default_weight:e[`random-steering-default-weight`]},session_affinity:d(e[`session-affinity`],`session-affinity`,`text`),session_affinity_attributes:{drain_duration:e[`session-affinity-attributes-drain-duration`],headers:e[`session-affinity-attributes-headers`],require_all_headers:e[`session-affinity-attributes-require-all-headers`],samesite:d(e[`session-affinity-attributes-samesite`],`session-affinity-attributes-samesite`,`text`),secure:d(e[`session-affinity-attributes-secure`],`session-affinity-attributes-secure`,`text`),zero_downtime_failover:d(e[`session-affinity-attributes-zero-downtime-failover`],`session-affinity-attributes-zero-downtime-failover`,`text`)},session_affinity_ttl:e[`session-affinity-ttl`],steering_policy:d(e[`steering-policy`],`steering-policy`,`text`),ttl:e.ttl}):o(e.body)});return}let r=await a(e),i=await n({zone:e.zone},r,{quiet:e.quiet});if(e.zoneId=i,e.body){let t=o(e.body);c(await u(`Updating`,async()=>r.loadBalancers.update({...t,zone_id:i,load_balancer_id:e[`load-balancer-id`]})),{successLabel:`Updated`});return}if(e[`default-pools`]===void 0)throw Error(`--default-pools is required (or pass --body with this field set).`);e[`fallback-pool`]===void 0&&(e[`fallback-pool`]=await t(`fallback-pool`,`The pool ID to use when all other pools are detected as unhealthy.`)),e.name===void 0&&(e.name=await t(`name`,`The DNS hostname to associate with your Load Balancer. If this hostname already exists as a DNS record in Cloudflare's DNS, the Load Balancer will take precedence and the DNS record will not be used.`));let f=s({adaptive_routing:{failover_across_pools:e[`adaptive-routing-failover-across-pools`]},default_pools:e[`default-pools`],description:d(e.description,`description`,`text`),enabled:e.enabled,fallback_pool:d(e[`fallback-pool`],`fallback-pool`,`text`),location_strategy:{mode:d(e[`location-strategy-mode`],`location-strategy-mode`,`text`),prefer_ecs:d(e[`location-strategy-prefer-ecs`],`location-strategy-prefer-ecs`,`text`)},name:d(e.name,`name`,`text`),networks:e.networks,proxied:e.proxied,random_steering:{default_weight:e[`random-steering-default-weight`]},session_affinity:d(e[`session-affinity`],`session-affinity`,`text`),session_affinity_attributes:{drain_duration:e[`session-affinity-attributes-drain-duration`],headers:e[`session-affinity-attributes-headers`],require_all_headers:e[`session-affinity-attributes-require-all-headers`],samesite:d(e[`session-affinity-attributes-samesite`],`session-affinity-attributes-samesite`,`text`),secure:d(e[`session-affinity-attributes-secure`],`session-affinity-attributes-secure`,`text`),zero_downtime_failover:d(e[`session-affinity-attributes-zero-downtime-failover`],`session-affinity-attributes-zero-downtime-failover`,`text`)},session_affinity_ttl:e[`session-affinity-ttl`],steering_policy:d(e[`steering-policy`],`steering-policy`,`text`),ttl:e.ttl});c(await u(`Updating`,async()=>r.loadBalancers.update({...f,zone_id:i,load_balancer_id:e[`load-balancer-id`]})),{successLabel:`Updated`})}},Ve={command:`load-balancers`,describe:`Distribute traffic across origin pools with health monitoring, geo-steering, and failover`,builder:e=>e.command(ee).command(h).command(_).command(y).command(x).command(Be).command(L).command(ae).command(Oe).command(je).command(Fe).command(Re).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Ve as default};
2
+ import{E as e,S as t,g as n,w as r,x as i}from"./oauth-Bk-F-tIO.mjs";import{n as a}from"./auth-CSC4yhEJ.mjs";import{n as o,t as s}from"./body-parser-DWSy7uZ8.mjs";import{t as c}from"./output-B6fBFRqe.mjs";import{n as l,t as u}from"./progress-DrDErV9w.mjs";import{n as d}from"./input-validation-_fMCApaH.mjs";import{t as f}from"./local-CYc9q7l2.mjs";import{t as p}from"./cli-types-BeyOc81z.mjs";function m(e){return e.option(`adaptive-routing-failover-across-pools`,{type:`boolean`,description:"Extends zero-downtime failover of requests to healthy origins from alternate pools, when no healthy alternate exists in the same pool, according to the failover order defined by traffic and origin steering. When set false (the default) zero-downtime failover will only occur between origins within the same pool. See `session_affinity_attributes` for control over when sessions are broken or reassigned.",default:!1}).option(`default-pools`,{type:`string`,array:!0,description:`A list of pool IDs ordered by their failover priority. Pools defined here are used by default, or when region_pools are not configured for a given region.`}).option(`description`,{type:`string`,description:`Object description.`}).option(`fallback-pool`,{type:`string`,description:`The pool ID to use when all other pools are detected as unhealthy.`}).option(`location-strategy-mode`,{type:`string`,description:'Determines the authoritative location when ECS is not preferred, does not exist in the request, or its GeoIP lookup is unsuccessful.\n- `"pop"`: Use the Cloudflare PoP location.\n- `"resolver_ip"`: Use the DNS resolver GeoIP location. If the GeoIP lookup is unsuccessful, use the Cloudflare PoP location.',choices:[`pop`,`resolver_ip`],default:`pop`}).option(`location-strategy-prefer-ecs`,{type:`string`,description:'Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the authoritative location.\n- `"always"`: Always prefer ECS.\n- `"never"`: Never prefer ECS.\n- `"proximity"`: Prefer ECS only when `steering_policy="proximity"`.\n- `"geo"`: Prefer ECS only when `steering_policy="geo"`.',choices:[`always`,`never`,`proximity`,`geo`],default:`proximity`}).option(`name`,{type:`string`,description:`The DNS hostname to associate with your Load Balancer. If this hostname already exists as a DNS record in Cloudflare's DNS, the Load Balancer will take precedence and the DNS record will not be used.`}).option(`networks`,{type:`string`,array:!0,description:`List of networks where Load Balancer or Pool is enabled.`}).option(`proxied`,{type:`boolean`,description:`Whether the hostname should be gray clouded (false) or orange clouded (true).`,default:!1}).option(`random-steering-default-weight`,{type:`number`,description:`The default weight for pools in the load balancer that are not specified in the pool_weights map.`,default:1}).option(`session-affinity`,{type:`string`,description:'Specifies the type of session affinity the load balancer should use unless specified as `"none"`. The supported types are: - `"cookie"`: On the first request to a proxied load balancer, a cookie is generated, encoding information of which origin the request will be forwarded to. Subsequent requests, by the same client to the same load balancer, will be sent to the origin server the cookie encodes, for the duration of the cookie and as long as the origin server remains healthy. If the cookie has expired or the origin server is unhealthy, then a new origin server is calculated and used. - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin selection is stable and based on the client\'s ip address. - `"header"`: On the first request to a proxied load balancer, a session key based on the configured HTTP headers (see `session_affinity_attributes.headers`) is generated, encoding the request headers used for storing in the load balancer session state which origin the request will be forwarded to. Subsequent requests to the load balancer with the same headers will be sent to the same origin server, for the duration of the session and as long as the origin server remains healthy. If the session has been idle for the duration of `session_affinity_ttl` seconds or the origin server is unhealthy, then a new origin server is calculated and used. See `headers` in `session_affinity_attributes` for additional required configuration.',choices:[`none`,`cookie`,`ip_cookie`,`header`],default:`none`}).option(`session-affinity-attributes-drain-duration`,{type:`number`,description:`Configures the drain duration in seconds. This field is only used when session affinity is enabled on the load balancer.`}).option(`session-affinity-attributes-headers`,{type:`string`,array:!0,description:'Configures the names of HTTP headers to base session affinity on when header `session_affinity` is enabled. At least one HTTP header name must be provided. To specify the exact cookies to be used, include an item in the following format: `"cookie:<cookie-name-1>,<cookie-name-2>"` (example) where everything after the colon is a comma-separated list of cookie names. Providing only `"cookie"` will result in all cookies being used. The default max number of HTTP header names that can be provided depends on your plan: 5 for Enterprise, 1 for all other plans.'}).option(`session-affinity-attributes-require-all-headers`,{type:`boolean`,description:'When header `session_affinity` is enabled, this option can be used to specify how HTTP headers on load balancing requests will be used. The supported values are: - `"true"`: Load balancing requests must contain *all* of the HTTP headers specified by the `headers` session affinity attribute, otherwise sessions aren\'t created. - `"false"`: Load balancing requests must contain *at least one* of the HTTP headers specified by the `headers` session affinity attribute, otherwise sessions aren\'t created.',default:!1}).option(`session-affinity-attributes-samesite`,{type:`string`,description:`Configures the SameSite attribute on session affinity cookie. Value "Auto" will be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: when using value "None", the secure attribute can not be set to "Never".`,choices:[`Auto`,`Lax`,`None`,`Strict`],default:`Auto`}).option(`session-affinity-attributes-secure`,{type:`string`,description:`Configures the Secure attribute on session affinity cookie. Value "Always" indicates the Secure attribute will be set in the Set-Cookie header, "Never" indicates the Secure attribute will not be set, and "Auto" will set the Secure attribute depending if Always Use HTTPS is enabled.`,choices:[`Auto`,`Always`,`Never`],default:`Auto`}).option(`session-affinity-attributes-zero-downtime-failover`,{type:`string`,description:'Configures the zero-downtime failover between origins within a pool when session affinity is enabled. This feature is currently incompatible with Argo, Tiered Cache, and Bandwidth Alliance. The supported values are: - `"none"`: No failover takes place for sessions pinned to the origin (default). - `"temporary"`: Traffic will be sent to another other healthy origin until the originally pinned origin is available; note that this can potentially result in heavy origin flapping. - `"sticky"`: The session affinity cookie is updated and subsequent requests are sent to the new origin. Note: Zero-downtime failover with sticky sessions is currently not supported for session affinity by header.',choices:[`none`,`temporary`,`sticky`],default:`none`}).option(`session-affinity-ttl`,{type:`number`,description:'Time, in seconds, until a client\'s session expires after being created. Once the expiry time has been reached, subsequent requests may get sent to a different origin server. The accepted ranges per `session_affinity` policy are: - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used unless explicitly set. The accepted range of values is between [1800, 604800]. - `"header"`: The current default of 1800 seconds will be used unless explicitly set. The accepted range of values is between [30, 3600]. Note: With session affinity by header, sessions only expire after they haven\'t been used for the number of seconds specified.'}).option(`steering-policy`,{type:`string`,description:'Steering Policy for this load balancer.\n- `"off"`: Use `default_pools`.\n- `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied requests, the country for `country_pools` is determined by `location_strategy`.\n- `"random"`: Select a pool randomly.\n- `"dynamic_latency"`: Use round trip time to select the closest pool in default_pools (requires pool health checks).\n- `"proximity"`: Use the pools\' latitude and longitude to select the closest pool using the Cloudflare PoP location for proxied requests or the location determined by `location_strategy` for non-proxied requests.\n- `"least_outstanding_requests"`: Select a pool by taking into consideration `random_steering` weights, as well as each pool\'s number of outstanding requests. Pools with more pending requests are weighted proportionately less relative to others.\n- `"least_connections"`: Select a pool by taking into consideration `random_steering` weights, as well as each pool\'s number of open connections. Pools with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.\n- `""`: Will map to `"geo"` if you use `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`.',choices:[`off`,`geo`,`random`,`dynamic_latency`,`proximity`,`least_outstanding_requests`,`least_connections`],default:``}).option(`ttl`,{type:`number`,description:`Time to live (TTL) of the DNS entry for the IP address returned by this load balancer. This only applies to gray-clouded (unproxied) load balancers.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ee={command:`create`,describe:`Create a new load balancer.`,builder:m,handler:async t=>{if(t.dryRun){l({command:`cf load-balancers create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/load_balancers`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?s({adaptive_routing:{failover_across_pools:t[`adaptive-routing-failover-across-pools`]},default_pools:t[`default-pools`],description:d(t.description,`description`,`text`),fallback_pool:d(t[`fallback-pool`],`fallback-pool`,`text`),location_strategy:{mode:d(t[`location-strategy-mode`],`location-strategy-mode`,`text`),prefer_ecs:d(t[`location-strategy-prefer-ecs`],`location-strategy-prefer-ecs`,`text`)},name:d(t.name,`name`,`text`),networks:t.networks,proxied:t.proxied,random_steering:{default_weight:t[`random-steering-default-weight`]},session_affinity:d(t[`session-affinity`],`session-affinity`,`text`),session_affinity_attributes:{drain_duration:t[`session-affinity-attributes-drain-duration`],headers:t[`session-affinity-attributes-headers`],require_all_headers:t[`session-affinity-attributes-require-all-headers`],samesite:d(t[`session-affinity-attributes-samesite`],`session-affinity-attributes-samesite`,`text`),secure:d(t[`session-affinity-attributes-secure`],`session-affinity-attributes-secure`,`text`),zero_downtime_failover:d(t[`session-affinity-attributes-zero-downtime-failover`],`session-affinity-attributes-zero-downtime-failover`,`text`)},session_affinity_ttl:t[`session-affinity-ttl`],steering_policy:d(t[`steering-policy`],`steering-policy`,`text`),ttl:t.ttl}):o(t.body)});return}let n=await a(t),r=await i({zone:t.zone},n,{quiet:t.quiet});if(t.zoneId=r,t.body){let e=o(t.body);c(await u(`Creating`,async()=>n.loadBalancers.create({...e,zone_id:r})),{successLabel:`Created`});return}if(t[`default-pools`]===void 0)throw Error(`--default-pools is required (or pass --body with this field set).`);t[`fallback-pool`]===void 0&&(t[`fallback-pool`]=await e(`fallback-pool`,`The pool ID to use when all other pools are detected as unhealthy.`)),t.name===void 0&&(t.name=await e(`name`,`The DNS hostname to associate with your Load Balancer. If this hostname already exists as a DNS record in Cloudflare's DNS, the Load Balancer will take precedence and the DNS record will not be used.`));let f=s({adaptive_routing:{failover_across_pools:t[`adaptive-routing-failover-across-pools`]},default_pools:t[`default-pools`],description:d(t.description,`description`,`text`),fallback_pool:d(t[`fallback-pool`],`fallback-pool`,`text`),location_strategy:{mode:d(t[`location-strategy-mode`],`location-strategy-mode`,`text`),prefer_ecs:d(t[`location-strategy-prefer-ecs`],`location-strategy-prefer-ecs`,`text`)},name:d(t.name,`name`,`text`),networks:t.networks,proxied:t.proxied,random_steering:{default_weight:t[`random-steering-default-weight`]},session_affinity:d(t[`session-affinity`],`session-affinity`,`text`),session_affinity_attributes:{drain_duration:t[`session-affinity-attributes-drain-duration`],headers:t[`session-affinity-attributes-headers`],require_all_headers:t[`session-affinity-attributes-require-all-headers`],samesite:d(t[`session-affinity-attributes-samesite`],`session-affinity-attributes-samesite`,`text`),secure:d(t[`session-affinity-attributes-secure`],`session-affinity-attributes-secure`,`text`),zero_downtime_failover:d(t[`session-affinity-attributes-zero-downtime-failover`],`session-affinity-attributes-zero-downtime-failover`,`text`)},session_affinity_ttl:t[`session-affinity-ttl`],steering_policy:d(t[`steering-policy`],`steering-policy`,`text`),ttl:t.ttl});c(await u(`Creating`,async()=>n.loadBalancers.create({...f,zone_id:r})),{successLabel:`Created`})}};function te(e){return e.positional(`load-balancer-id`,{type:`string`,description:`Load balancer 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 h={command:`delete <load-balancer-id>`,describe:`Delete a configured load balancer.`,builder:te,handler:async e=>{if(e.dryRun){l({command:`cf load-balancers delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/load_balancers/${e[`load-balancer-id`]==null?`<load-balancer-id>`:encodeURIComponent(String(e[`load-balancer-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"load-balancer-id":String(e[`load-balancer-id`]??``)},bodyKind:`none`});return}let t=await a(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await r({force:!!e.force})){process.stderr.write(`Aborted.
3
+ `);return}c(await u(`Deleting`,async()=>t.loadBalancers.delete({zone_id:n,load_balancer_id:e[`load-balancer-id`]})),{successLabel:`Deleted`})}};function g(e){return e.positional(`load-balancer-id`,{type:`string`,description:`Load balancer ID`,demandOption:!0}).option(`adaptive-routing-failover-across-pools`,{type:`boolean`,description:"Extends zero-downtime failover of requests to healthy origins from alternate pools, when no healthy alternate exists in the same pool, according to the failover order defined by traffic and origin steering. When set false (the default) zero-downtime failover will only occur between origins within the same pool. See `session_affinity_attributes` for control over when sessions are broken or reassigned."}).option(`default-pools`,{type:`string`,array:!0,description:`A list of pool IDs ordered by their failover priority. Pools defined here are used by default, or when region_pools are not configured for a given region.`}).option(`description`,{type:`string`,description:`Object description.`}).option(`enabled`,{type:`boolean`,description:`Whether to enable (the default) this load balancer.`}).option(`fallback-pool`,{type:`string`,description:`The pool ID to use when all other pools are detected as unhealthy.`}).option(`location-strategy-mode`,{type:`string`,description:'Determines the authoritative location when ECS is not preferred, does not exist in the request, or its GeoIP lookup is unsuccessful.\n- `"pop"`: Use the Cloudflare PoP location.\n- `"resolver_ip"`: Use the DNS resolver GeoIP location. If the GeoIP lookup is unsuccessful, use the Cloudflare PoP location.',choices:[`pop`,`resolver_ip`]}).option(`location-strategy-prefer-ecs`,{type:`string`,description:'Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the authoritative location.\n- `"always"`: Always prefer ECS.\n- `"never"`: Never prefer ECS.\n- `"proximity"`: Prefer ECS only when `steering_policy="proximity"`.\n- `"geo"`: Prefer ECS only when `steering_policy="geo"`.',choices:[`always`,`never`,`proximity`,`geo`]}).option(`name`,{type:`string`,description:`The DNS hostname to associate with your Load Balancer. If this hostname already exists as a DNS record in Cloudflare's DNS, the Load Balancer will take precedence and the DNS record will not be used.`}).option(`proxied`,{type:`boolean`,description:`Whether the hostname should be gray clouded (false) or orange clouded (true).`}).option(`random-steering-default-weight`,{type:`number`,description:`The default weight for pools in the load balancer that are not specified in the pool_weights map.`}).option(`session-affinity`,{type:`string`,description:'Specifies the type of session affinity the load balancer should use unless specified as `"none"`. The supported types are: - `"cookie"`: On the first request to a proxied load balancer, a cookie is generated, encoding information of which origin the request will be forwarded to. Subsequent requests, by the same client to the same load balancer, will be sent to the origin server the cookie encodes, for the duration of the cookie and as long as the origin server remains healthy. If the cookie has expired or the origin server is unhealthy, then a new origin server is calculated and used. - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin selection is stable and based on the client\'s ip address. - `"header"`: On the first request to a proxied load balancer, a session key based on the configured HTTP headers (see `session_affinity_attributes.headers`) is generated, encoding the request headers used for storing in the load balancer session state which origin the request will be forwarded to. Subsequent requests to the load balancer with the same headers will be sent to the same origin server, for the duration of the session and as long as the origin server remains healthy. If the session has been idle for the duration of `session_affinity_ttl` seconds or the origin server is unhealthy, then a new origin server is calculated and used. See `headers` in `session_affinity_attributes` for additional required configuration.',choices:[`none`,`cookie`,`ip_cookie`,`header`]}).option(`session-affinity-attributes-drain-duration`,{type:`number`,description:`Configures the drain duration in seconds. This field is only used when session affinity is enabled on the load balancer.`}).option(`session-affinity-attributes-headers`,{type:`string`,array:!0,description:'Configures the names of HTTP headers to base session affinity on when header `session_affinity` is enabled. At least one HTTP header name must be provided. To specify the exact cookies to be used, include an item in the following format: `"cookie:<cookie-name-1>,<cookie-name-2>"` (example) where everything after the colon is a comma-separated list of cookie names. Providing only `"cookie"` will result in all cookies being used. The default max number of HTTP header names that can be provided depends on your plan: 5 for Enterprise, 1 for all other plans.'}).option(`session-affinity-attributes-require-all-headers`,{type:`boolean`,description:'When header `session_affinity` is enabled, this option can be used to specify how HTTP headers on load balancing requests will be used. The supported values are: - `"true"`: Load balancing requests must contain *all* of the HTTP headers specified by the `headers` session affinity attribute, otherwise sessions aren\'t created. - `"false"`: Load balancing requests must contain *at least one* of the HTTP headers specified by the `headers` session affinity attribute, otherwise sessions aren\'t created.'}).option(`session-affinity-attributes-samesite`,{type:`string`,description:`Configures the SameSite attribute on session affinity cookie. Value "Auto" will be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: when using value "None", the secure attribute can not be set to "Never".`,choices:[`Auto`,`Lax`,`None`,`Strict`]}).option(`session-affinity-attributes-secure`,{type:`string`,description:`Configures the Secure attribute on session affinity cookie. Value "Always" indicates the Secure attribute will be set in the Set-Cookie header, "Never" indicates the Secure attribute will not be set, and "Auto" will set the Secure attribute depending if Always Use HTTPS is enabled.`,choices:[`Auto`,`Always`,`Never`]}).option(`session-affinity-attributes-zero-downtime-failover`,{type:`string`,description:'Configures the zero-downtime failover between origins within a pool when session affinity is enabled. This feature is currently incompatible with Argo, Tiered Cache, and Bandwidth Alliance. The supported values are: - `"none"`: No failover takes place for sessions pinned to the origin (default). - `"temporary"`: Traffic will be sent to another other healthy origin until the originally pinned origin is available; note that this can potentially result in heavy origin flapping. - `"sticky"`: The session affinity cookie is updated and subsequent requests are sent to the new origin. Note: Zero-downtime failover with sticky sessions is currently not supported for session affinity by header.',choices:[`none`,`temporary`,`sticky`]}).option(`session-affinity-ttl`,{type:`number`,description:'Time, in seconds, until a client\'s session expires after being created. Once the expiry time has been reached, subsequent requests may get sent to a different origin server. The accepted ranges per `session_affinity` policy are: - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used unless explicitly set. The accepted range of values is between [1800, 604800]. - `"header"`: The current default of 1800 seconds will be used unless explicitly set. The accepted range of values is between [30, 3600]. Note: With session affinity by header, sessions only expire after they haven\'t been used for the number of seconds specified.'}).option(`steering-policy`,{type:`string`,description:'Steering Policy for this load balancer.\n- `"off"`: Use `default_pools`.\n- `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied requests, the country for `country_pools` is determined by `location_strategy`.\n- `"random"`: Select a pool randomly.\n- `"dynamic_latency"`: Use round trip time to select the closest pool in default_pools (requires pool health checks).\n- `"proximity"`: Use the pools\' latitude and longitude to select the closest pool using the Cloudflare PoP location for proxied requests or the location determined by `location_strategy` for non-proxied requests.\n- `"least_outstanding_requests"`: Select a pool by taking into consideration `random_steering` weights, as well as each pool\'s number of outstanding requests. Pools with more pending requests are weighted proportionately less relative to others.\n- `"least_connections"`: Select a pool by taking into consideration `random_steering` weights, as well as each pool\'s number of open connections. Pools with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.\n- `""`: Will map to `"geo"` if you use `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`.',choices:[`off`,`geo`,`random`,`dynamic_latency`,`proximity`,`least_outstanding_requests`,`least_connections`]}).option(`ttl`,{type:`number`,description:`Time to live (TTL) of the DNS entry for the IP address returned by this load balancer. This only applies to gray-clouded (unproxied) load balancers.`}).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 _={command:`edit <load-balancer-id>`,describe:`Apply changes to an existing load balancer, overwriting the supplied properties.`,builder:g,handler:async e=>{if(e.dryRun){l({command:`cf load-balancers edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/load_balancers/${e[`load-balancer-id`]==null?`<load-balancer-id>`:encodeURIComponent(String(e[`load-balancer-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"load-balancer-id":String(e[`load-balancer-id`]??``)},bodyKind:`json`,body:e.body===void 0?s({adaptive_routing:{failover_across_pools:e[`adaptive-routing-failover-across-pools`]},default_pools:e[`default-pools`],description:d(e.description,`description`,`text`),enabled:e.enabled,fallback_pool:d(e[`fallback-pool`],`fallback-pool`,`text`),location_strategy:{mode:d(e[`location-strategy-mode`],`location-strategy-mode`,`text`),prefer_ecs:d(e[`location-strategy-prefer-ecs`],`location-strategy-prefer-ecs`,`text`)},name:d(e.name,`name`,`text`),proxied:e.proxied,random_steering:{default_weight:e[`random-steering-default-weight`]},session_affinity:d(e[`session-affinity`],`session-affinity`,`text`),session_affinity_attributes:{drain_duration:e[`session-affinity-attributes-drain-duration`],headers:e[`session-affinity-attributes-headers`],require_all_headers:e[`session-affinity-attributes-require-all-headers`],samesite:d(e[`session-affinity-attributes-samesite`],`session-affinity-attributes-samesite`,`text`),secure:d(e[`session-affinity-attributes-secure`],`session-affinity-attributes-secure`,`text`),zero_downtime_failover:d(e[`session-affinity-attributes-zero-downtime-failover`],`session-affinity-attributes-zero-downtime-failover`,`text`)},session_affinity_ttl:e[`session-affinity-ttl`],steering_policy:d(e[`steering-policy`],`steering-policy`,`text`),ttl:e.ttl}):o(e.body)});return}let t=await a(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=o(e.body);c(await u(`Updating`,async()=>t.loadBalancers.edit({...r,zone_id:n,load_balancer_id:e[`load-balancer-id`]})),{successLabel:`Updated`});return}let r=s({adaptive_routing:{failover_across_pools:e[`adaptive-routing-failover-across-pools`]},default_pools:e[`default-pools`],description:d(e.description,`description`,`text`),enabled:e.enabled,fallback_pool:d(e[`fallback-pool`],`fallback-pool`,`text`),location_strategy:{mode:d(e[`location-strategy-mode`],`location-strategy-mode`,`text`),prefer_ecs:d(e[`location-strategy-prefer-ecs`],`location-strategy-prefer-ecs`,`text`)},name:d(e.name,`name`,`text`),proxied:e.proxied,random_steering:{default_weight:e[`random-steering-default-weight`]},session_affinity:d(e[`session-affinity`],`session-affinity`,`text`),session_affinity_attributes:{drain_duration:e[`session-affinity-attributes-drain-duration`],headers:e[`session-affinity-attributes-headers`],require_all_headers:e[`session-affinity-attributes-require-all-headers`],samesite:d(e[`session-affinity-attributes-samesite`],`session-affinity-attributes-samesite`,`text`),secure:d(e[`session-affinity-attributes-secure`],`session-affinity-attributes-secure`,`text`),zero_downtime_failover:d(e[`session-affinity-attributes-zero-downtime-failover`],`session-affinity-attributes-zero-downtime-failover`,`text`)},session_affinity_ttl:e[`session-affinity-ttl`],steering_policy:d(e[`steering-policy`],`steering-policy`,`text`),ttl:e.ttl});c(await u(`Updating`,async()=>t.loadBalancers.edit({...r,zone_id:n,load_balancer_id:e[`load-balancer-id`]})),{successLabel:`Updated`})}};function v(e){return e.positional(`load-balancer-id`,{type:`string`,description:`Load balancer ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`get <load-balancer-id>`,describe:`Fetch a single configured load balancer.`,builder:v,handler:async e=>{if(e.dryRun){l({command:`cf load-balancers get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/load_balancers/${e[`load-balancer-id`]==null?`<load-balancer-id>`:encodeURIComponent(String(e[`load-balancer-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"load-balancer-id":String(e[`load-balancer-id`]??``)},bodyKind:`none`});return}let t=await a(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,c(await u(`Loading`,async()=>t.loadBalancers.get({zone_id:n,load_balancer_id:e[`load-balancer-id`]})),{successLabel:`Loaded`})}};function b(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`list`,describe:`List configured load balancers.`,builder:b,handler:async e=>{if(e.dryRun){l({command:`cf load-balancers list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/load_balancers`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await a(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,c(await u(`Loading`,async()=>t.loadBalancers.list({zone_id:n})),{successLabel:`Loaded`})}};function S(e){return e.option(`description`,{type:`string`,description:`A short description of the monitor group`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const C={command:`create`,describe:`Create a new monitor group.`,builder:S,handler:async r=>{if(r.dryRun){l({command:`cf load-balancers monitor-groups create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/load_balancers/monitor_groups`,pathParams:{},bodyKind:`json`,body:r.body===void 0?s({description:d(r.description,`description`,`text`)}):o(r.body)});return}let i=await a(r),p=r.local?f:await n(i);if(r.accountId=p,r.body){let e=o(r.body);c(await u(`Creating`,async()=>i.loadBalancers.monitorGroups.create({body:e,account_id:p})),{successLabel:`Created`});return}r.description===void 0&&(r.description=await e(`description`,`A short description of the monitor group`));let m=s({description:d(r.description,`description`,`text`)});c(await u(`Creating`,async()=>i.loadBalancers.monitorGroups.create({body:m,account_id:p})),{successLabel:`Created`})}};function w(e){return e.positional(`monitor-group-id`,{type:`string`,description:`Monitor group 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 T={command:`delete <monitor-group-id>`,describe:`Delete a configured monitor group.`,builder:w,handler:async e=>{if(e.dryRun){l({command:`cf load-balancers monitor-groups delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/load_balancers/monitor_groups/${e[`monitor-group-id`]==null?`<monitor-group-id>`:encodeURIComponent(String(e[`monitor-group-id`]))}`,pathParams:{"monitor-group-id":String(e[`monitor-group-id`]??``)},bodyKind:`none`});return}let i=await a(e),o=e.local?f:await n(i);if(e.accountId=o,!await r({force:!!e.force})){process.stderr.write(`Aborted.
4
+ `);return}c(await u(`Deleting`,async()=>i.loadBalancers.monitorGroups.delete({account_id:o,monitor_group_id:e[`monitor-group-id`]})),{successLabel:`Deleted`})}};function E(e){return e.positional(`monitor-group-id`,{type:`string`,description:`Monitor group ID`,demandOption:!0}).option(`description`,{type:`string`,description:`A short description of the monitor group`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const D={command:`edit <monitor-group-id>`,describe:`Apply changes to an existing monitor group, overwriting the supplied properties.`,builder:E,handler:async r=>{if(r.dryRun){l({command:`cf load-balancers monitor-groups edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/load_balancers/monitor_groups/${r[`monitor-group-id`]==null?`<monitor-group-id>`:encodeURIComponent(String(r[`monitor-group-id`]))}`,pathParams:{"monitor-group-id":String(r[`monitor-group-id`]??``)},bodyKind:`json`,body:r.body===void 0?s({description:d(r.description,`description`,`text`)}):o(r.body)});return}let i=await a(r),p=r.local?f:await n(i);if(r.accountId=p,r.body){let e=o(r.body);c(await u(`Updating`,async()=>i.loadBalancers.monitorGroups.edit({body:e,account_id:p,monitor_group_id:r[`monitor-group-id`]})),{successLabel:`Updated`});return}r.description===void 0&&(r.description=await e(`description`,`A short description of the monitor group`));let m=s({description:d(r.description,`description`,`text`)});c(await u(`Updating`,async()=>i.loadBalancers.monitorGroups.edit({body:m,account_id:p,monitor_group_id:r[`monitor-group-id`]})),{successLabel:`Updated`})}};function O(e){return e.positional(`monitor-group-id`,{type:`string`,description:`Monitor group ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`get <monitor-group-id>`,describe:`Fetch a single configured monitor group.`,builder:O,handler:async e=>{if(e.dryRun){l({command:`cf load-balancers monitor-groups get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/load_balancers/monitor_groups/${e[`monitor-group-id`]==null?`<monitor-group-id>`:encodeURIComponent(String(e[`monitor-group-id`]))}`,pathParams:{"monitor-group-id":String(e[`monitor-group-id`]??``)},bodyKind:`none`});return}let r=await a(e),i=e.local?f:await n(r);e.accountId=i,c(await u(`Loading`,async()=>r.loadBalancers.monitorGroups.get({account_id:i,monitor_group_id:e[`monitor-group-id`]})),{successLabel:`Loaded`})}};function A(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`list`,describe:`List configured monitor groups.`,builder:A,handler:async e=>{if(e.dryRun){l({command:`cf load-balancers monitor-groups list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/load_balancers/monitor_groups`,pathParams:{},bodyKind:`none`});return}let r=await a(e),i=e.local?f:await n(r);e.accountId=i,c(await u(`Loading`,async()=>r.loadBalancers.monitorGroups.list({account_id:i})),{successLabel:`Loaded`})}};function M(e){return e.option(`monitor-group-id`,{type:`string`,description:`Monitor group ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const N={command:`list`,describe:`Get the list of resources that reference the provided monitor group.`,builder:M,handler:async e=>{if(e.dryRun){l({command:`cf load-balancers monitor-groups references list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/load_balancers/monitor_groups/${e[`monitor-group-id`]==null?`<monitor-group-id>`:encodeURIComponent(String(e[`monitor-group-id`]))}/references`,pathParams:{"monitor-group-id":String(e[`monitor-group-id`]??``)},bodyKind:`none`});return}let r=await a(e),i=e.local?f:await n(r);e.accountId=i,c(await u(`Loading`,async()=>r.loadBalancers.monitorGroups.references.list({account_id:i,monitor_group_id:e[`monitor-group-id`]})),{successLabel:`Loaded`})}},P={command:`references`,describe:`List references to monitor groups used by load balancer pools`,builder:e=>e.command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function F(e){return e.positional(`monitor-group-id`,{type:`string`,description:`Monitor group ID`,demandOption:!0}).option(`description`,{type:`string`,description:`A short description of the monitor group`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const I={command:`update <monitor-group-id>`,describe:`Modify a configured monitor group.`,builder:F,handler:async r=>{if(r.dryRun){l({command:`cf load-balancers monitor-groups update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/load_balancers/monitor_groups/${r[`monitor-group-id`]==null?`<monitor-group-id>`:encodeURIComponent(String(r[`monitor-group-id`]))}`,pathParams:{"monitor-group-id":String(r[`monitor-group-id`]??``)},bodyKind:`json`,body:r.body===void 0?s({description:d(r.description,`description`,`text`)}):o(r.body)});return}let i=await a(r),p=r.local?f:await n(i);if(r.accountId=p,r.body){let e=o(r.body);c(await u(`Updating`,async()=>i.loadBalancers.monitorGroups.update({body:e,account_id:p,monitor_group_id:r[`monitor-group-id`]})),{successLabel:`Updated`});return}r.description===void 0&&(r.description=await e(`description`,`A short description of the monitor group`));let m=s({description:d(r.description,`description`,`text`)});c(await u(`Updating`,async()=>i.loadBalancers.monitorGroups.update({body:m,account_id:p,monitor_group_id:r[`monitor-group-id`]})),{successLabel:`Updated`})}},L={command:`monitor-groups`,describe:`Group monitors together for shared configuration and bulk management`,builder:e=>e.command(C).command(T).command(D).command(k).command(j).command(I).command(P).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function R(e){return e.option(`allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when monitor use HTTPS. This parameter is currently only valid for HTTP and HTTPS monitors.`,default:!1}).option(`consecutive-down`,{type:`number`,description:`To be marked unhealthy the monitored origin must fail this healthcheck N consecutive times.`}).option(`consecutive-up`,{type:`number`,description:`To be marked healthy the monitored origin must pass this healthcheck N consecutive times.`}).option(`description`,{type:`string`,description:`Object description.`,default:``}).option(`expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`expected-codes`,{type:`string`,description:`The expected HTTP response code or code range of the health check. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`follow-redirects`,{type:`boolean`,description:`Follow redirects if returned by the origin. This parameter is only valid for HTTP and HTTPS monitors.`,default:!1}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations.`,default:60}).option(`method`,{type:`string`,description:`The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' for TCP based health checks.`}).option(`path`,{type:`string`,description:`The endpoint path you want to conduct a health check against. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`port`,{type:`number`,description:`The port number to connect to for the health check. Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port when using a non-standard port (HTTP: default 80, HTTPS: default 443).`}).option(`probe-zone`,{type:`string`,description:`Assign this monitor to emulate the specified zone while probing. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`,default:2}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`,default:5}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'.`,choices:[`http`,`https`,`tcp`,`udp_icmp`,`icmp_ping`,`smtp`],default:`http`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const z={command:`create`,describe:`Create a configured monitor.`,builder:R,handler:async e=>{if(e.dryRun){l({command:`cf load-balancers monitors create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/load_balancers/monitors`,pathParams:{},bodyKind:`json`,body:e.body===void 0?s({allow_insecure:e[`allow-insecure`],consecutive_down:e[`consecutive-down`],consecutive_up:e[`consecutive-up`],description:d(e.description,`description`,`text`),expected_body:d(e[`expected-body`],`expected-body`,`text`),expected_codes:d(e[`expected-codes`],`expected-codes`,`text`),follow_redirects:e[`follow-redirects`],interval:e.interval,method:d(e.method,`method`,`text`),path:d(e.path,`path`,`text`),port:e.port,probe_zone:d(e[`probe-zone`],`probe-zone`,`text`),retries:e.retries,timeout:e.timeout,type:d(e.type,`type`,`text`)}):o(e.body)});return}let r=await a(e),i=e.local?f:await n(r);if(e.accountId=i,e.body){let t=o(e.body);c(await u(`Creating`,async()=>r.loadBalancers.monitors.create({body:t,account_id:i})),{successLabel:`Created`});return}let p=s({allow_insecure:e[`allow-insecure`],consecutive_down:e[`consecutive-down`],consecutive_up:e[`consecutive-up`],description:d(e.description,`description`,`text`),expected_body:d(e[`expected-body`],`expected-body`,`text`),expected_codes:d(e[`expected-codes`],`expected-codes`,`text`),follow_redirects:e[`follow-redirects`],interval:e.interval,method:d(e.method,`method`,`text`),path:d(e.path,`path`,`text`),port:e.port,probe_zone:d(e[`probe-zone`],`probe-zone`,`text`),retries:e.retries,timeout:e.timeout,type:d(e.type,`type`,`text`)});c(await u(`Creating`,async()=>r.loadBalancers.monitors.create({body:p,account_id:i})),{successLabel:`Created`})}};function B(e){return e.positional(`monitor-id`,{type:`string`,description:`Monitor 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 V={command:`delete <monitor-id>`,describe:`Delete a configured monitor.`,builder:B,handler:async e=>{if(e.dryRun){l({command:`cf load-balancers monitors delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/load_balancers/monitors/${e[`monitor-id`]==null?`<monitor-id>`:encodeURIComponent(String(e[`monitor-id`]))}`,pathParams:{"monitor-id":String(e[`monitor-id`]??``)},bodyKind:`none`});return}let i=await a(e),o=e.local?f:await n(i);if(e.accountId=o,!await r({force:!!e.force})){process.stderr.write(`Aborted.
5
+ `);return}c(await u(`Deleting`,async()=>i.loadBalancers.monitors.delete({account_id:o,monitor_id:e[`monitor-id`]})),{successLabel:`Deleted`})}};function H(e){return e.positional(`monitor-id`,{type:`string`,description:`Monitor ID`,demandOption:!0}).option(`allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when monitor use HTTPS. This parameter is currently only valid for HTTP and HTTPS monitors.`}).option(`consecutive-down`,{type:`number`,description:`To be marked unhealthy the monitored origin must fail this healthcheck N consecutive times.`}).option(`consecutive-up`,{type:`number`,description:`To be marked healthy the monitored origin must pass this healthcheck N consecutive times.`}).option(`description`,{type:`string`,description:`Object description.`}).option(`expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`expected-codes`,{type:`string`,description:`The expected HTTP response code or code range of the health check. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`follow-redirects`,{type:`boolean`,description:`Follow redirects if returned by the origin. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations.`}).option(`method`,{type:`string`,description:`The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' for TCP based health checks.`}).option(`path`,{type:`string`,description:`The endpoint path you want to conduct a health check against. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`port`,{type:`number`,description:`The port number to connect to for the health check. Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port when using a non-standard port (HTTP: default 80, HTTPS: default 443).`}).option(`probe-zone`,{type:`string`,description:`Assign this monitor to emulate the specified zone while probing. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'.`,choices:[`http`,`https`,`tcp`,`udp_icmp`,`icmp_ping`,`smtp`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const U={command:`edit <monitor-id>`,describe:`Apply changes to an existing monitor, overwriting the supplied properties.`,builder:H,handler:async e=>{if(e.dryRun){l({command:`cf load-balancers monitors edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/load_balancers/monitors/${e[`monitor-id`]==null?`<monitor-id>`:encodeURIComponent(String(e[`monitor-id`]))}`,pathParams:{"monitor-id":String(e[`monitor-id`]??``)},bodyKind:`json`,body:e.body===void 0?s({allow_insecure:e[`allow-insecure`],consecutive_down:e[`consecutive-down`],consecutive_up:e[`consecutive-up`],description:d(e.description,`description`,`text`),expected_body:d(e[`expected-body`],`expected-body`,`text`),expected_codes:d(e[`expected-codes`],`expected-codes`,`text`),follow_redirects:e[`follow-redirects`],interval:e.interval,method:d(e.method,`method`,`text`),path:d(e.path,`path`,`text`),port:e.port,probe_zone:d(e[`probe-zone`],`probe-zone`,`text`),retries:e.retries,timeout:e.timeout,type:d(e.type,`type`,`text`)}):o(e.body)});return}let r=await a(e),i=e.local?f:await n(r);if(e.accountId=i,e.body){let t=o(e.body);c(await u(`Updating`,async()=>r.loadBalancers.monitors.edit({body:t,account_id:i,monitor_id:e[`monitor-id`]})),{successLabel:`Updated`});return}let p=s({allow_insecure:e[`allow-insecure`],consecutive_down:e[`consecutive-down`],consecutive_up:e[`consecutive-up`],description:d(e.description,`description`,`text`),expected_body:d(e[`expected-body`],`expected-body`,`text`),expected_codes:d(e[`expected-codes`],`expected-codes`,`text`),follow_redirects:e[`follow-redirects`],interval:e.interval,method:d(e.method,`method`,`text`),path:d(e.path,`path`,`text`),port:e.port,probe_zone:d(e[`probe-zone`],`probe-zone`,`text`),retries:e.retries,timeout:e.timeout,type:d(e.type,`type`,`text`)});c(await u(`Updating`,async()=>r.loadBalancers.monitors.edit({body:p,account_id:i,monitor_id:e[`monitor-id`]})),{successLabel:`Updated`})}};function W(e){return e.positional(`monitor-id`,{type:`string`,description:`Monitor ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const G={command:`get <monitor-id>`,describe:`List a single configured monitor for an account.`,builder:W,handler:async e=>{if(e.dryRun){l({command:`cf load-balancers monitors get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/load_balancers/monitors/${e[`monitor-id`]==null?`<monitor-id>`:encodeURIComponent(String(e[`monitor-id`]))}`,pathParams:{"monitor-id":String(e[`monitor-id`]??``)},bodyKind:`none`});return}let r=await a(e),i=e.local?f:await n(r);e.accountId=i,c(await u(`Loading`,async()=>r.loadBalancers.monitors.get({account_id:i,monitor_id:e[`monitor-id`]})),{successLabel:`Loaded`})}};function K(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const q={command:`list`,describe:`List configured monitors for an account.`,builder:K,handler:async e=>{if(e.dryRun){l({command:`cf load-balancers monitors list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/load_balancers/monitors`,pathParams:{},bodyKind:`none`});return}let r=await a(e),i=e.local?f:await n(r);e.accountId=i,c(await u(`Loading`,async()=>r.loadBalancers.monitors.list({account_id:i})),{successLabel:`Loaded`})}};function J(e){return e.positional(`monitor-id`,{type:`string`,description:`Monitor ID`,demandOption:!0}).option(`allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when monitor use HTTPS. This parameter is currently only valid for HTTP and HTTPS monitors.`,default:!1}).option(`consecutive-down`,{type:`number`,description:`To be marked unhealthy the monitored origin must fail this healthcheck N consecutive times.`}).option(`consecutive-up`,{type:`number`,description:`To be marked healthy the monitored origin must pass this healthcheck N consecutive times.`}).option(`description`,{type:`string`,description:`Object description.`,default:``}).option(`expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`expected-codes`,{type:`string`,description:`The expected HTTP response code or code range of the health check. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`follow-redirects`,{type:`boolean`,description:`Follow redirects if returned by the origin. This parameter is only valid for HTTP and HTTPS monitors.`,default:!1}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations.`,default:60}).option(`method`,{type:`string`,description:`The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' for TCP based health checks.`}).option(`path`,{type:`string`,description:`The endpoint path you want to conduct a health check against. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`port`,{type:`number`,description:`The port number to connect to for the health check. Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port when using a non-standard port (HTTP: default 80, HTTPS: default 443).`}).option(`probe-zone`,{type:`string`,description:`Assign this monitor to emulate the specified zone while probing. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`,default:2}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`,default:5}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'.`,choices:[`http`,`https`,`tcp`,`udp_icmp`,`icmp_ping`,`smtp`],default:`http`}).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 Y={command:`create <monitor-id>`,describe:`Preview pools using the specified monitor with provided monitor details. The returned preview_id can be used in the preview endpoint to retrieve the results.`,builder:J,handler:async e=>{if(e.dryRun){l({command:`cf load-balancers monitors previews create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/load_balancers/monitors/${e[`monitor-id`]==null?`<monitor-id>`:encodeURIComponent(String(e[`monitor-id`]))}/preview`,pathParams:{"monitor-id":String(e[`monitor-id`]??``)},bodyKind:`json`,body:e.body===void 0?s({allow_insecure:e[`allow-insecure`],consecutive_down:e[`consecutive-down`],consecutive_up:e[`consecutive-up`],description:d(e.description,`description`,`text`),expected_body:d(e[`expected-body`],`expected-body`,`text`),expected_codes:d(e[`expected-codes`],`expected-codes`,`text`),follow_redirects:e[`follow-redirects`],interval:e.interval,method:d(e.method,`method`,`text`),path:d(e.path,`path`,`text`),port:e.port,probe_zone:d(e[`probe-zone`],`probe-zone`,`text`),retries:e.retries,timeout:e.timeout,type:d(e.type,`type`,`text`)}):o(e.body)});return}let r=await a(e),i=e.local?f:await n(r);if(e.accountId=i,e.body){let t=o(e.body);c(await u(`Creating`,async()=>r.loadBalancers.monitors.previews.create({body:t,account_id:i,monitor_id:e[`monitor-id`]})),{successLabel:`Created`});return}let p=s({allow_insecure:e[`allow-insecure`],consecutive_down:e[`consecutive-down`],consecutive_up:e[`consecutive-up`],description:d(e.description,`description`,`text`),expected_body:d(e[`expected-body`],`expected-body`,`text`),expected_codes:d(e[`expected-codes`],`expected-codes`,`text`),follow_redirects:e[`follow-redirects`],interval:e.interval,method:d(e.method,`method`,`text`),path:d(e.path,`path`,`text`),port:e.port,probe_zone:d(e[`probe-zone`],`probe-zone`,`text`),retries:e.retries,timeout:e.timeout,type:d(e.type,`type`,`text`)});c(await u(`Creating`,async()=>r.loadBalancers.monitors.previews.create({body:p,account_id:i,monitor_id:e[`monitor-id`]})),{successLabel:`Created`})}},X={command:`previews`,describe:`Health check configurations that probe origin servers and determine pool availability`,builder:e=>e.command(Y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Z(e){return e.positional(`monitor-id`,{type:`string`,description:`Monitor ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Q={command:`get <monitor-id>`,describe:`Get the list of resources that reference the provided monitor.`,builder:Z,handler:async e=>{if(e.dryRun){l({command:`cf load-balancers monitors references get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/load_balancers/monitors/${e[`monitor-id`]==null?`<monitor-id>`:encodeURIComponent(String(e[`monitor-id`]))}/references`,pathParams:{"monitor-id":String(e[`monitor-id`]??``)},bodyKind:`none`});return}let r=await a(e),i=e.local?f:await n(r);e.accountId=i,c(await u(`Loading`,async()=>r.loadBalancers.monitors.references.get({account_id:i,monitor_id:e[`monitor-id`]})),{successLabel:`Loaded`})}},ne={command:`references`,describe:`Health check configurations that probe origin servers and determine pool availability`,builder:e=>e.command(Q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function re(e){return e.positional(`monitor-id`,{type:`string`,description:`Monitor ID`,demandOption:!0}).option(`allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when monitor use HTTPS. This parameter is currently only valid for HTTP and HTTPS monitors.`}).option(`consecutive-down`,{type:`number`,description:`To be marked unhealthy the monitored origin must fail this healthcheck N consecutive times.`}).option(`consecutive-up`,{type:`number`,description:`To be marked healthy the monitored origin must pass this healthcheck N consecutive times.`}).option(`description`,{type:`string`,description:`Object description.`}).option(`expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`expected-codes`,{type:`string`,description:`The expected HTTP response code or code range of the health check. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`follow-redirects`,{type:`boolean`,description:`Follow redirects if returned by the origin. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations.`}).option(`method`,{type:`string`,description:`The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' for TCP based health checks.`}).option(`path`,{type:`string`,description:`The endpoint path you want to conduct a health check against. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`port`,{type:`number`,description:`The port number to connect to for the health check. Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port when using a non-standard port (HTTP: default 80, HTTPS: default 443).`}).option(`probe-zone`,{type:`string`,description:`Assign this monitor to emulate the specified zone while probing. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'.`,choices:[`http`,`https`,`tcp`,`udp_icmp`,`icmp_ping`,`smtp`]}).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 ie={command:`update <monitor-id>`,describe:`Modify a configured monitor.`,builder:re,handler:async e=>{if(e.dryRun){l({command:`cf load-balancers monitors update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/load_balancers/monitors/${e[`monitor-id`]==null?`<monitor-id>`:encodeURIComponent(String(e[`monitor-id`]))}`,pathParams:{"monitor-id":String(e[`monitor-id`]??``)},bodyKind:`json`,body:e.body===void 0?s({allow_insecure:e[`allow-insecure`],consecutive_down:e[`consecutive-down`],consecutive_up:e[`consecutive-up`],description:d(e.description,`description`,`text`),expected_body:d(e[`expected-body`],`expected-body`,`text`),expected_codes:d(e[`expected-codes`],`expected-codes`,`text`),follow_redirects:e[`follow-redirects`],interval:e.interval,method:d(e.method,`method`,`text`),path:d(e.path,`path`,`text`),port:e.port,probe_zone:d(e[`probe-zone`],`probe-zone`,`text`),retries:e.retries,timeout:e.timeout,type:d(e.type,`type`,`text`)}):o(e.body)});return}let r=await a(e),i=e.local?f:await n(r);if(e.accountId=i,e.body){let t=o(e.body);c(await u(`Updating`,async()=>r.loadBalancers.monitors.update({body:t,account_id:i,monitor_id:e[`monitor-id`]})),{successLabel:`Updated`});return}let p=s({allow_insecure:e[`allow-insecure`],consecutive_down:e[`consecutive-down`],consecutive_up:e[`consecutive-up`],description:d(e.description,`description`,`text`),expected_body:d(e[`expected-body`],`expected-body`,`text`),expected_codes:d(e[`expected-codes`],`expected-codes`,`text`),follow_redirects:e[`follow-redirects`],interval:e.interval,method:d(e.method,`method`,`text`),path:d(e.path,`path`,`text`),port:e.port,probe_zone:d(e[`probe-zone`],`probe-zone`,`text`),retries:e.retries,timeout:e.timeout,type:d(e.type,`type`,`text`)});c(await u(`Updating`,async()=>r.loadBalancers.monitors.update({body:p,account_id:i,monitor_id:e[`monitor-id`]})),{successLabel:`Updated`})}},ae={command:`monitors`,describe:`Health check configurations that probe origin servers and determine pool availability`,builder:e=>e.command(z).command(V).command(U).command(G).command(q).command(ie).command(X).command(ne).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function oe(e){return e.option(`notification-email`,{type:`string`,description:'The email address to send health status notifications to. This field is now deprecated in favor of Cloudflare Notifications for Load Balancing, so only resetting this field with an empty string `""` is accepted.'}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const se={command:`bulk-edit`,describe:"Apply changes to a number of existing pools, overwriting the supplied properties. Pools are ordered by ascending `name`. Returns the list of affected pools. Supports the standard pagination query parameters, either `limit`/`offset` or `per_page`/`page`.",builder:oe,handler:async e=>{if(e.dryRun){l({command:`cf load-balancers pools bulk-edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/load_balancers/pools`,pathParams:{},bodyKind:`json`,body:e.body===void 0?s({notification_email:d(e[`notification-email`],`notification-email`,`text`)}):o(e.body)});return}let r=await a(e),i=e.local?f:await n(r);if(e.accountId=i,e.body){let t=o(e.body);c(await u(`Updating`,async()=>r.loadBalancers.pools.bulkEdit({body:t,account_id:i})),{successLabel:`Updated`});return}let p=s({notification_email:d(e[`notification-email`],`notification-email`,`text`)});c(await u(`Updating`,async()=>r.loadBalancers.pools.bulkEdit({body:p,account_id:i})),{successLabel:`Updated`})}};function ce(e){return e.option(`description`,{type:`string`,description:`A human-readable description of the pool.`,default:``}).option(`enabled`,{type:`boolean`,description:`Whether to enable (the default) or disable this pool. Disabled pools will not receive traffic and are excluded from health checks. Disabling a pool will cause any load balancers using it to failover to the next pool (if any).`,default:!0}).option(`latitude`,{type:`number`,description:`The latitude of the data center containing the origins used in this pool in decimal degrees. If this is set, longitude must also be set.`}).option(`load-shedding-default-percent`,{type:`number`,description:`The percent of traffic to shed from the pool, according to the default policy. Applies to new sessions and traffic without session affinity.`,default:0}).option(`load-shedding-default-policy`,{type:`string`,description:`The default policy to use when load shedding. A random policy randomly sheds a given percent of requests. A hash policy computes a hash over the CF-Connecting-IP address and sheds all requests originating from a percent of IPs.`,choices:[`random`,`hash`],default:`random`}).option(`load-shedding-session-percent`,{type:`number`,description:`The percent of existing sessions to shed from the pool, according to the session policy.`,default:0}).option(`load-shedding-session-policy`,{type:`string`,description:`Only the hash policy is supported for existing sessions (to avoid exponential decay).`,choices:[`hash`],default:`hash`}).option(`longitude`,{type:`number`,description:`The longitude of the data center containing the origins used in this pool in decimal degrees. If this is set, latitude must also be set.`}).option(`minimum-origins`,{type:`number`,description:`The minimum number of origins that must be healthy for this pool to serve traffic. If the number of healthy origins falls below this number, the pool will be marked unhealthy and will failover to the next available pool.`,default:1}).option(`monitor`,{type:`string`,description:`The ID of the Monitor to use for checking the health of origins within this pool.`}).option(`monitor-group`,{type:`string`,description:`The ID of the Monitor Group to use for checking the health of origins within this pool.`}).option(`name`,{type:`string`,description:`A short name (tag) for the pool. Only alphanumeric characters, hyphens, and underscores are allowed.`}).option(`notification-email`,{type:`string`,description:`This field is now deprecated. It has been moved to Cloudflare's Centralized Notification service https://developers.cloudflare.com/fundamentals/notifications/. The email address to send health status notifications to. This can be an individual mailbox or a mailing list. Multiple emails can be supplied as a comma delimited list.`,default:``}).option(`notification-filter-origin-disable`,{type:`boolean`,description:`If set true, disable notifications for this type of resource (pool or origin).`,default:!1}).option(`notification-filter-origin-healthy`,{type:`boolean`,description:`If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).`}).option(`notification-filter-pool-disable`,{type:`boolean`,description:`If set true, disable notifications for this type of resource (pool or origin).`,default:!1}).option(`notification-filter-pool-healthy`,{type:`boolean`,description:`If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).`}).option(`origin-steering-policy`,{type:`string`,description:'The type of origin steering policy to use.\n- `"random"`: Select an origin randomly.\n- `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP address.\n- `"least_outstanding_requests"`: Select an origin by taking into consideration origin weights, as well as each origin\'s number of outstanding requests. Origins with more pending requests are weighted proportionately less relative to others.\n- `"least_connections"`: Select an origin by taking into consideration origin weights, as well as each origin\'s number of open connections. Origins with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.',choices:[`random`,`hash`,`least_outstanding_requests`,`least_connections`],default:`random`}).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 le={command:`create`,describe:`Create a new pool.`,builder:ce,handler:async r=>{if(r.dryRun){l({command:`cf load-balancers pools create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/load_balancers/pools`,pathParams:{},bodyKind:`json`,body:r.body===void 0?s({description:d(r.description,`description`,`text`),enabled:r.enabled,latitude:r.latitude,load_shedding:{default_percent:r[`load-shedding-default-percent`],default_policy:d(r[`load-shedding-default-policy`],`load-shedding-default-policy`,`text`),session_percent:r[`load-shedding-session-percent`],session_policy:d(r[`load-shedding-session-policy`],`load-shedding-session-policy`,`text`)},longitude:r.longitude,minimum_origins:r[`minimum-origins`],monitor:d(r.monitor,`monitor`,`text`),monitor_group:d(r[`monitor-group`],`monitor-group`,`text`),name:d(r.name,`name`,`text`),notification_email:d(r[`notification-email`],`notification-email`,`text`),notification_filter:{origin:{disable:r[`notification-filter-origin-disable`],healthy:r[`notification-filter-origin-healthy`]},pool:{disable:r[`notification-filter-pool-disable`],healthy:r[`notification-filter-pool-healthy`]}},origin_steering:{policy:d(r[`origin-steering-policy`],`origin-steering-policy`,`text`)}}):o(r.body)});return}let i=await a(r),p=r.local?f:await n(i);if(r.accountId=p,r.body){let e=o(r.body);c(await u(`Creating`,async()=>i.loadBalancers.pools.create({...e,account_id:p})),{successLabel:`Created`});return}r.name===void 0&&(r.name=await e(`name`,`A short name (tag) for the pool. Only alphanumeric characters, hyphens, and underscores are allowed.`));let m=s({description:d(r.description,`description`,`text`),enabled:r.enabled,latitude:r.latitude,load_shedding:{default_percent:r[`load-shedding-default-percent`],default_policy:d(r[`load-shedding-default-policy`],`load-shedding-default-policy`,`text`),session_percent:r[`load-shedding-session-percent`],session_policy:d(r[`load-shedding-session-policy`],`load-shedding-session-policy`,`text`)},longitude:r.longitude,minimum_origins:r[`minimum-origins`],monitor:d(r.monitor,`monitor`,`text`),monitor_group:d(r[`monitor-group`],`monitor-group`,`text`),name:d(r.name,`name`,`text`),notification_email:d(r[`notification-email`],`notification-email`,`text`),notification_filter:{origin:{disable:r[`notification-filter-origin-disable`],healthy:r[`notification-filter-origin-healthy`]},pool:{disable:r[`notification-filter-pool-disable`],healthy:r[`notification-filter-pool-healthy`]}},origin_steering:{policy:d(r[`origin-steering-policy`],`origin-steering-policy`,`text`)}});c(await u(`Creating`,async()=>i.loadBalancers.pools.create({...m,account_id:p})),{successLabel:`Created`})}};function ue(e){return e.positional(`pool-id`,{type:`string`,description:`Pool 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 de={command:`delete <pool-id>`,describe:`Delete a configured pool.`,builder:ue,handler:async e=>{if(e.dryRun){l({command:`cf load-balancers pools delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/load_balancers/pools/${e[`pool-id`]==null?`<pool-id>`:encodeURIComponent(String(e[`pool-id`]))}`,pathParams:{"pool-id":String(e[`pool-id`]??``)},bodyKind:`none`});return}let i=await a(e),o=e.local?f:await n(i);if(e.accountId=o,!await r({force:!!e.force})){process.stderr.write(`Aborted.
6
+ `);return}c(await u(`Deleting`,async()=>i.loadBalancers.pools.delete({account_id:o,pool_id:e[`pool-id`]})),{successLabel:`Deleted`})}};function fe(e){return e.positional(`pool-id`,{type:`string`,description:`Pool ID`,demandOption:!0}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means every Cloudflare data center.`}).option(`description`,{type:`string`,description:`A human-readable description of the pool.`}).option(`enabled`,{type:`boolean`,description:`Whether to enable (the default) or disable this pool. Disabled pools will not receive traffic and are excluded from health checks. Disabling a pool will cause any load balancers using it to failover to the next pool (if any).`}).option(`latitude`,{type:`number`,description:`The latitude of the data center containing the origins used in this pool in decimal degrees. If this is set, longitude must also be set.`}).option(`load-shedding-default-percent`,{type:`number`,description:`The percent of traffic to shed from the pool, according to the default policy. Applies to new sessions and traffic without session affinity.`}).option(`load-shedding-default-policy`,{type:`string`,description:`The default policy to use when load shedding. A random policy randomly sheds a given percent of requests. A hash policy computes a hash over the CF-Connecting-IP address and sheds all requests originating from a percent of IPs.`,choices:[`random`,`hash`]}).option(`load-shedding-session-percent`,{type:`number`,description:`The percent of existing sessions to shed from the pool, according to the session policy.`}).option(`load-shedding-session-policy`,{type:`string`,description:`Only the hash policy is supported for existing sessions (to avoid exponential decay).`,choices:[`hash`]}).option(`longitude`,{type:`number`,description:`The longitude of the data center containing the origins used in this pool in decimal degrees. If this is set, latitude must also be set.`}).option(`minimum-origins`,{type:`number`,description:`The minimum number of origins that must be healthy for this pool to serve traffic. If the number of healthy origins falls below this number, the pool will be marked unhealthy and will failover to the next available pool.`}).option(`monitor`,{type:`string`,description:`The ID of the Monitor to use for checking the health of origins within this pool.`}).option(`monitor-group`,{type:`string`,description:`The ID of the Monitor Group to use for checking the health of origins within this pool.`}).option(`name`,{type:`string`,description:`A short name (tag) for the pool. Only alphanumeric characters, hyphens, and underscores are allowed.`}).option(`notification-email`,{type:`string`,description:`This field is now deprecated. It has been moved to Cloudflare's Centralized Notification service https://developers.cloudflare.com/fundamentals/notifications/. The email address to send health status notifications to. This can be an individual mailbox or a mailing list. Multiple emails can be supplied as a comma delimited list.`}).option(`notification-filter-origin-disable`,{type:`boolean`,description:`If set true, disable notifications for this type of resource (pool or origin).`}).option(`notification-filter-origin-healthy`,{type:`boolean`,description:`If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).`}).option(`notification-filter-pool-disable`,{type:`boolean`,description:`If set true, disable notifications for this type of resource (pool or origin).`}).option(`notification-filter-pool-healthy`,{type:`boolean`,description:`If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).`}).option(`origin-steering-policy`,{type:`string`,description:'The type of origin steering policy to use.\n- `"random"`: Select an origin randomly.\n- `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP address.\n- `"least_outstanding_requests"`: Select an origin by taking into consideration origin weights, as well as each origin\'s number of outstanding requests. Origins with more pending requests are weighted proportionately less relative to others.\n- `"least_connections"`: Select an origin by taking into consideration origin weights, as well as each origin\'s number of open connections. Origins with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.',choices:[`random`,`hash`,`least_outstanding_requests`,`least_connections`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const pe={command:`edit <pool-id>`,describe:`Apply changes to an existing pool, overwriting the supplied properties.`,builder:fe,handler:async e=>{if(e.dryRun){l({command:`cf load-balancers pools edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/load_balancers/pools/${e[`pool-id`]==null?`<pool-id>`:encodeURIComponent(String(e[`pool-id`]))}`,pathParams:{"pool-id":String(e[`pool-id`]??``)},bodyKind:`json`,body:e.body===void 0?s({check_regions:e[`check-regions`],description:d(e.description,`description`,`text`),enabled:e.enabled,latitude:e.latitude,load_shedding:{default_percent:e[`load-shedding-default-percent`],default_policy:d(e[`load-shedding-default-policy`],`load-shedding-default-policy`,`text`),session_percent:e[`load-shedding-session-percent`],session_policy:d(e[`load-shedding-session-policy`],`load-shedding-session-policy`,`text`)},longitude:e.longitude,minimum_origins:e[`minimum-origins`],monitor:d(e.monitor,`monitor`,`text`),monitor_group:d(e[`monitor-group`],`monitor-group`,`text`),name:d(e.name,`name`,`text`),notification_email:d(e[`notification-email`],`notification-email`,`text`),notification_filter:{origin:{disable:e[`notification-filter-origin-disable`],healthy:e[`notification-filter-origin-healthy`]},pool:{disable:e[`notification-filter-pool-disable`],healthy:e[`notification-filter-pool-healthy`]}},origin_steering:{policy:d(e[`origin-steering-policy`],`origin-steering-policy`,`text`)}}):o(e.body)});return}let r=await a(e),i=e.local?f:await n(r);if(e.accountId=i,e.body){let t=o(e.body);c(await u(`Updating`,async()=>r.loadBalancers.pools.edit({...t,account_id:i,pool_id:e[`pool-id`]})),{successLabel:`Updated`});return}let p=s({check_regions:e[`check-regions`],description:d(e.description,`description`,`text`),enabled:e.enabled,latitude:e.latitude,load_shedding:{default_percent:e[`load-shedding-default-percent`],default_policy:d(e[`load-shedding-default-policy`],`load-shedding-default-policy`,`text`),session_percent:e[`load-shedding-session-percent`],session_policy:d(e[`load-shedding-session-policy`],`load-shedding-session-policy`,`text`)},longitude:e.longitude,minimum_origins:e[`minimum-origins`],monitor:d(e.monitor,`monitor`,`text`),monitor_group:d(e[`monitor-group`],`monitor-group`,`text`),name:d(e.name,`name`,`text`),notification_email:d(e[`notification-email`],`notification-email`,`text`),notification_filter:{origin:{disable:e[`notification-filter-origin-disable`],healthy:e[`notification-filter-origin-healthy`]},pool:{disable:e[`notification-filter-pool-disable`],healthy:e[`notification-filter-pool-healthy`]}},origin_steering:{policy:d(e[`origin-steering-policy`],`origin-steering-policy`,`text`)}});c(await u(`Updating`,async()=>r.loadBalancers.pools.edit({...p,account_id:i,pool_id:e[`pool-id`]})),{successLabel:`Updated`})}};function me(e){return e.positional(`pool-id`,{type:`string`,description:`Pool ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const he={command:`get <pool-id>`,describe:`Fetch a single configured pool.`,builder:me,handler:async e=>{if(e.dryRun){l({command:`cf load-balancers pools get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/load_balancers/pools/${e[`pool-id`]==null?`<pool-id>`:encodeURIComponent(String(e[`pool-id`]))}`,pathParams:{"pool-id":String(e[`pool-id`]??``)},bodyKind:`none`});return}let r=await a(e),i=e.local?f:await n(r);e.accountId=i,c(await u(`Loading`,async()=>r.loadBalancers.pools.get({account_id:i,pool_id:e[`pool-id`]})),{successLabel:`Loaded`})}};function ge(e){return e.positional(`pool-id`,{type:`string`,description:`Pool ID`,demandOption:!0}).option(`allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when monitor use HTTPS. This parameter is currently only valid for HTTP and HTTPS monitors.`,default:!1}).option(`consecutive-down`,{type:`number`,description:`To be marked unhealthy the monitored origin must fail this healthcheck N consecutive times.`}).option(`consecutive-up`,{type:`number`,description:`To be marked healthy the monitored origin must pass this healthcheck N consecutive times.`}).option(`description`,{type:`string`,description:`Object description.`,default:``}).option(`expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`expected-codes`,{type:`string`,description:`The expected HTTP response code or code range of the health check. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`follow-redirects`,{type:`boolean`,description:`Follow redirects if returned by the origin. This parameter is only valid for HTTP and HTTPS monitors.`,default:!1}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations.`,default:60}).option(`method`,{type:`string`,description:`The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' for TCP based health checks.`}).option(`path`,{type:`string`,description:`The endpoint path you want to conduct a health check against. This parameter is only valid for HTTP and HTTPS monitors.`}).option(`port`,{type:`number`,description:`The port number to connect to for the health check. Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port when using a non-standard port (HTTP: default 80, HTTPS: default 443).`}).option(`probe-zone`,{type:`string`,description:`Assign this monitor to emulate the specified zone while probing. This parameter is only valid for HTTP and HTTPS monitors.`,default:``}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`,default:2}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`,default:5}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'.`,choices:[`http`,`https`,`tcp`,`udp_icmp`,`icmp_ping`,`smtp`],default:`http`}).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 _e={command:`create <pool-id>`,describe:`Preview pool health using provided monitor details. The returned preview_id can be used in the preview endpoint to retrieve the results.`,builder:ge,handler:async e=>{if(e.dryRun){l({command:`cf load-balancers pools health create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/load_balancers/pools/${e[`pool-id`]==null?`<pool-id>`:encodeURIComponent(String(e[`pool-id`]))}/preview`,pathParams:{"pool-id":String(e[`pool-id`]??``)},bodyKind:`json`,body:e.body===void 0?s({allow_insecure:e[`allow-insecure`],consecutive_down:e[`consecutive-down`],consecutive_up:e[`consecutive-up`],description:d(e.description,`description`,`text`),expected_body:d(e[`expected-body`],`expected-body`,`text`),expected_codes:d(e[`expected-codes`],`expected-codes`,`text`),follow_redirects:e[`follow-redirects`],interval:e.interval,method:d(e.method,`method`,`text`),path:d(e.path,`path`,`text`),port:e.port,probe_zone:d(e[`probe-zone`],`probe-zone`,`text`),retries:e.retries,timeout:e.timeout,type:d(e.type,`type`,`text`)}):o(e.body)});return}let r=await a(e),i=e.local?f:await n(r);if(e.accountId=i,e.body){let t=o(e.body);c(await u(`Creating`,async()=>r.loadBalancers.pools.health.create({body:t,account_id:i,pool_id:e[`pool-id`]})),{successLabel:`Created`});return}let p=s({allow_insecure:e[`allow-insecure`],consecutive_down:e[`consecutive-down`],consecutive_up:e[`consecutive-up`],description:d(e.description,`description`,`text`),expected_body:d(e[`expected-body`],`expected-body`,`text`),expected_codes:d(e[`expected-codes`],`expected-codes`,`text`),follow_redirects:e[`follow-redirects`],interval:e.interval,method:d(e.method,`method`,`text`),path:d(e.path,`path`,`text`),port:e.port,probe_zone:d(e[`probe-zone`],`probe-zone`,`text`),retries:e.retries,timeout:e.timeout,type:d(e.type,`type`,`text`)});c(await u(`Creating`,async()=>r.loadBalancers.pools.health.create({body:p,account_id:i,pool_id:e[`pool-id`]})),{successLabel:`Created`})}};function ve(e){return e.positional(`pool-id`,{type:`string`,description:`Pool ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ye={command:`get <pool-id>`,describe:`Fetch the latest pool health status for a single pool.`,builder:ve,handler:async e=>{if(e.dryRun){l({command:`cf load-balancers pools health get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/load_balancers/pools/${e[`pool-id`]==null?`<pool-id>`:encodeURIComponent(String(e[`pool-id`]))}/health`,pathParams:{"pool-id":String(e[`pool-id`]??``)},bodyKind:`none`});return}let r=await a(e),i=e.local?f:await n(r);e.accountId=i,c(await u(`Loading`,async()=>r.loadBalancers.pools.health.get({account_id:i,pool_id:e[`pool-id`]})),{successLabel:`Loaded`})}},be={command:`health`,describe:`Origin server pools with weighted traffic distribution, health thresholds, and geographic preferences`,builder:e=>e.command(_e).command(ye).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function xe(e){return e.option(`monitor`,{type:`string`,description:`The ID of the Monitor to use for checking the health of origins within this pool.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Se={command:`list`,describe:`List configured pools.`,builder:xe,handler:async e=>{let r={monitor:e.monitor};if(e.dryRun){l({command:`cf load-balancers pools list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/load_balancers/pools`,pathParams:{},query:r,bodyKind:`none`});return}let i=await a(e),o=e.local?f:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.loadBalancers.pools.list({account_id:o,...r})),{successLabel:`Loaded`})}};function Ce(e){return e.positional(`pool-id`,{type:`string`,description:`Pool ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const we={command:`get <pool-id>`,describe:`Get the list of resources that reference the provided pool.`,builder:Ce,handler:async e=>{if(e.dryRun){l({command:`cf load-balancers pools references get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/load_balancers/pools/${e[`pool-id`]==null?`<pool-id>`:encodeURIComponent(String(e[`pool-id`]))}/references`,pathParams:{"pool-id":String(e[`pool-id`]??``)},bodyKind:`none`});return}let r=await a(e),i=e.local?f:await n(r);e.accountId=i,c(await u(`Loading`,async()=>r.loadBalancers.pools.references.get({account_id:i,pool_id:e[`pool-id`]})),{successLabel:`Loaded`})}},Te={command:`references`,describe:`Origin server pools with weighted traffic distribution, health thresholds, and geographic preferences`,builder:e=>e.command(we).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ee(e){return e.positional(`pool-id`,{type:`string`,description:`Pool ID`,demandOption:!0}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means every Cloudflare data center.`}).option(`description`,{type:`string`,description:`A human-readable description of the pool.`}).option(`enabled`,{type:`boolean`,description:`Whether to enable (the default) or disable this pool. Disabled pools will not receive traffic and are excluded from health checks. Disabling a pool will cause any load balancers using it to failover to the next pool (if any).`}).option(`latitude`,{type:`number`,description:`The latitude of the data center containing the origins used in this pool in decimal degrees. If this is set, longitude must also be set.`}).option(`load-shedding-default-percent`,{type:`number`,description:`The percent of traffic to shed from the pool, according to the default policy. Applies to new sessions and traffic without session affinity.`}).option(`load-shedding-default-policy`,{type:`string`,description:`The default policy to use when load shedding. A random policy randomly sheds a given percent of requests. A hash policy computes a hash over the CF-Connecting-IP address and sheds all requests originating from a percent of IPs.`,choices:[`random`,`hash`]}).option(`load-shedding-session-percent`,{type:`number`,description:`The percent of existing sessions to shed from the pool, according to the session policy.`}).option(`load-shedding-session-policy`,{type:`string`,description:`Only the hash policy is supported for existing sessions (to avoid exponential decay).`,choices:[`hash`]}).option(`longitude`,{type:`number`,description:`The longitude of the data center containing the origins used in this pool in decimal degrees. If this is set, latitude must also be set.`}).option(`minimum-origins`,{type:`number`,description:`The minimum number of origins that must be healthy for this pool to serve traffic. If the number of healthy origins falls below this number, the pool will be marked unhealthy and will failover to the next available pool.`}).option(`monitor`,{type:`string`,description:`The ID of the Monitor to use for checking the health of origins within this pool.`}).option(`monitor-group`,{type:`string`,description:`The ID of the Monitor Group to use for checking the health of origins within this pool.`}).option(`name`,{type:`string`,description:`A short name (tag) for the pool. Only alphanumeric characters, hyphens, and underscores are allowed.`}).option(`notification-email`,{type:`string`,description:`This field is now deprecated. It has been moved to Cloudflare's Centralized Notification service https://developers.cloudflare.com/fundamentals/notifications/. The email address to send health status notifications to. This can be an individual mailbox or a mailing list. Multiple emails can be supplied as a comma delimited list.`}).option(`notification-filter-origin-disable`,{type:`boolean`,description:`If set true, disable notifications for this type of resource (pool or origin).`}).option(`notification-filter-origin-healthy`,{type:`boolean`,description:`If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).`}).option(`notification-filter-pool-disable`,{type:`boolean`,description:`If set true, disable notifications for this type of resource (pool or origin).`}).option(`notification-filter-pool-healthy`,{type:`boolean`,description:`If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).`}).option(`origin-steering-policy`,{type:`string`,description:'The type of origin steering policy to use.\n- `"random"`: Select an origin randomly.\n- `"hash"`: Select an origin by computing a hash over the CF-Connecting-IP address.\n- `"least_outstanding_requests"`: Select an origin by taking into consideration origin weights, as well as each origin\'s number of outstanding requests. Origins with more pending requests are weighted proportionately less relative to others.\n- `"least_connections"`: Select an origin by taking into consideration origin weights, as well as each origin\'s number of open connections. Origins with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.',choices:[`random`,`hash`,`least_outstanding_requests`,`least_connections`]}).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 De={command:`update <pool-id>`,describe:`Modify a configured pool.`,builder:Ee,handler:async r=>{if(r.dryRun){l({command:`cf load-balancers pools update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/load_balancers/pools/${r[`pool-id`]==null?`<pool-id>`:encodeURIComponent(String(r[`pool-id`]))}`,pathParams:{"pool-id":String(r[`pool-id`]??``)},bodyKind:`json`,body:r.body===void 0?s({check_regions:r[`check-regions`],description:d(r.description,`description`,`text`),enabled:r.enabled,latitude:r.latitude,load_shedding:{default_percent:r[`load-shedding-default-percent`],default_policy:d(r[`load-shedding-default-policy`],`load-shedding-default-policy`,`text`),session_percent:r[`load-shedding-session-percent`],session_policy:d(r[`load-shedding-session-policy`],`load-shedding-session-policy`,`text`)},longitude:r.longitude,minimum_origins:r[`minimum-origins`],monitor:d(r.monitor,`monitor`,`text`),monitor_group:d(r[`monitor-group`],`monitor-group`,`text`),name:d(r.name,`name`,`text`),notification_email:d(r[`notification-email`],`notification-email`,`text`),notification_filter:{origin:{disable:r[`notification-filter-origin-disable`],healthy:r[`notification-filter-origin-healthy`]},pool:{disable:r[`notification-filter-pool-disable`],healthy:r[`notification-filter-pool-healthy`]}},origin_steering:{policy:d(r[`origin-steering-policy`],`origin-steering-policy`,`text`)}}):o(r.body)});return}let i=await a(r),p=r.local?f:await n(i);if(r.accountId=p,r.body){let e=o(r.body);c(await u(`Updating`,async()=>i.loadBalancers.pools.update({...e,account_id:p,pool_id:r[`pool-id`]})),{successLabel:`Updated`});return}r.name===void 0&&(r.name=await e(`name`,`A short name (tag) for the pool. Only alphanumeric characters, hyphens, and underscores are allowed.`));let m=s({check_regions:r[`check-regions`],description:d(r.description,`description`,`text`),enabled:r.enabled,latitude:r.latitude,load_shedding:{default_percent:r[`load-shedding-default-percent`],default_policy:d(r[`load-shedding-default-policy`],`load-shedding-default-policy`,`text`),session_percent:r[`load-shedding-session-percent`],session_policy:d(r[`load-shedding-session-policy`],`load-shedding-session-policy`,`text`)},longitude:r.longitude,minimum_origins:r[`minimum-origins`],monitor:d(r.monitor,`monitor`,`text`),monitor_group:d(r[`monitor-group`],`monitor-group`,`text`),name:d(r.name,`name`,`text`),notification_email:d(r[`notification-email`],`notification-email`,`text`),notification_filter:{origin:{disable:r[`notification-filter-origin-disable`],healthy:r[`notification-filter-origin-healthy`]},pool:{disable:r[`notification-filter-pool-disable`],healthy:r[`notification-filter-pool-healthy`]}},origin_steering:{policy:d(r[`origin-steering-policy`],`origin-steering-policy`,`text`)}});c(await u(`Updating`,async()=>i.loadBalancers.pools.update({...m,account_id:p,pool_id:r[`pool-id`]})),{successLabel:`Updated`})}},Oe={command:`pools`,describe:`Origin server pools with weighted traffic distribution, health thresholds, and geographic preferences`,builder:e=>e.command(se).command(le).command(de).command(pe).command(he).command(Se).command(De).command(be).command(Te).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ke(e){return e.positional(`preview-id`,{type:`string`,description:`Preview ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ae={command:`get <preview-id>`,describe:`Get the result of a previous preview operation using the provided preview_id.`,builder:ke,handler:async e=>{if(e.dryRun){l({command:`cf load-balancers previews get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/load_balancers/preview/${e[`preview-id`]==null?`<preview-id>`:encodeURIComponent(String(e[`preview-id`]))}`,pathParams:{"preview-id":String(e[`preview-id`]??``)},bodyKind:`none`});return}let r=await a(e),i=e.local?f:await n(r);e.accountId=i,c(await u(`Loading`,async()=>r.loadBalancers.previews.get({account_id:i,preview_id:e[`preview-id`]})),{successLabel:`Loaded`})}},je={command:`previews`,describe:`Preview the result of a health check monitor configuration before applying it`,builder:e=>e.command(Ae).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Me(e){return e.positional(`region-id`,{type:`string`,description:`A list of Cloudflare regions. WNAM: Western North America, ENAM: Eastern North America, WEU: Western Europe, EEU: Eastern Europe, NSAM: Northern South America, SSAM: Southern South America, OC: Oceania, ME: Middle East, NAF: North Africa, SAF: South Africa, SAS: Southern Asia, SEAS: South East Asia, NEAS: North East Asia).`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ne={command:`get <region-id>`,describe:`Get a single region mapping.`,builder:p(Me),handler:async e=>{if(e.dryRun){l({command:`cf load-balancers regions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/load_balancers/regions/${e[`region-id`]==null?`<region-id>`:encodeURIComponent(String(e[`region-id`]))}`,pathParams:{"region-id":String(e[`region-id`]??``)},bodyKind:`none`});return}let r=await a(e),i=e.local?f:await n(r);e.accountId=i,c(await u(`Loading`,async()=>r.loadBalancers.regions.get({account_id:i,region_id:e[`region-id`]})),{successLabel:`Loaded`})}};function Pe(e){return e.option(`subdivision-code`,{type:`string`,description:`Two-letter subdivision code followed in ISO 3166-2.`}).option(`subdivision-code-a2`,{type:`string`,description:`Two-letter subdivision code followed in ISO 3166-2.`}).option(`country-code-a2`,{type:`string`,description:`Two-letter alpha-2 country code followed in ISO 3166-1.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $={command:`list`,describe:`List all region mappings.`,builder:Pe,handler:async e=>{let r={subdivision_code:e[`subdivision-code`],subdivision_code_a2:e[`subdivision-code-a2`],country_code_a2:e[`country-code-a2`]};if(e.dryRun){l({command:`cf load-balancers regions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/load_balancers/regions`,pathParams:{},query:r,bodyKind:`none`});return}let i=await a(e),o=e.local?f:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.loadBalancers.regions.list({account_id:o,...r})),{successLabel:`Loaded`})}},Fe={command:`regions`,describe:`Geographic regions used for regional pool steering and traffic policies`,builder:e=>e.command(Ne).command($).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ie(e){return e.option(`query`,{type:`string`,description:`Search query term.`}).option(`references`,{type:`string`,description:`The type of references to include. "*" to include both referral and referrer references. "" to not include any reference information.`,choices:[``,`*`,`referral`,`referrer`]}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Le={command:`list`,describe:`Search for Load Balancing resources.`,builder:p(Ie),handler:async e=>{let r={query:e.query,references:e.references,page:e.page,per_page:e[`per-page`]};if(e.dryRun){l({command:`cf load-balancers searches list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/load_balancers/search`,pathParams:{},query:r,bodyKind:`none`});return}let i=await a(e),o=e.local?f:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.loadBalancers.searches.list({account_id:o,...r})),{successLabel:`Loaded`})}},Re={command:`searches`,describe:`Search across all load balancer resources (pools, monitors, load balancers) by name or reference`,builder:e=>e.command(Le).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ze(e){return e.positional(`load-balancer-id`,{type:`string`,description:`Load balancer ID`,demandOption:!0}).option(`adaptive-routing-failover-across-pools`,{type:`boolean`,description:"Extends zero-downtime failover of requests to healthy origins from alternate pools, when no healthy alternate exists in the same pool, according to the failover order defined by traffic and origin steering. When set false (the default) zero-downtime failover will only occur between origins within the same pool. See `session_affinity_attributes` for control over when sessions are broken or reassigned."}).option(`default-pools`,{type:`string`,array:!0,description:`A list of pool IDs ordered by their failover priority. Pools defined here are used by default, or when region_pools are not configured for a given region.`}).option(`description`,{type:`string`,description:`Object description.`}).option(`enabled`,{type:`boolean`,description:`Whether to enable (the default) this load balancer.`}).option(`fallback-pool`,{type:`string`,description:`The pool ID to use when all other pools are detected as unhealthy.`}).option(`location-strategy-mode`,{type:`string`,description:'Determines the authoritative location when ECS is not preferred, does not exist in the request, or its GeoIP lookup is unsuccessful.\n- `"pop"`: Use the Cloudflare PoP location.\n- `"resolver_ip"`: Use the DNS resolver GeoIP location. If the GeoIP lookup is unsuccessful, use the Cloudflare PoP location.',choices:[`pop`,`resolver_ip`]}).option(`location-strategy-prefer-ecs`,{type:`string`,description:'Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the authoritative location.\n- `"always"`: Always prefer ECS.\n- `"never"`: Never prefer ECS.\n- `"proximity"`: Prefer ECS only when `steering_policy="proximity"`.\n- `"geo"`: Prefer ECS only when `steering_policy="geo"`.',choices:[`always`,`never`,`proximity`,`geo`]}).option(`name`,{type:`string`,description:`The DNS hostname to associate with your Load Balancer. If this hostname already exists as a DNS record in Cloudflare's DNS, the Load Balancer will take precedence and the DNS record will not be used.`}).option(`networks`,{type:`string`,array:!0,description:`List of networks where Load Balancer or Pool is enabled.`}).option(`proxied`,{type:`boolean`,description:`Whether the hostname should be gray clouded (false) or orange clouded (true).`}).option(`random-steering-default-weight`,{type:`number`,description:`The default weight for pools in the load balancer that are not specified in the pool_weights map.`}).option(`session-affinity`,{type:`string`,description:'Specifies the type of session affinity the load balancer should use unless specified as `"none"`. The supported types are: - `"cookie"`: On the first request to a proxied load balancer, a cookie is generated, encoding information of which origin the request will be forwarded to. Subsequent requests, by the same client to the same load balancer, will be sent to the origin server the cookie encodes, for the duration of the cookie and as long as the origin server remains healthy. If the cookie has expired or the origin server is unhealthy, then a new origin server is calculated and used. - `"ip_cookie"`: Behaves the same as `"cookie"` except the initial origin selection is stable and based on the client\'s ip address. - `"header"`: On the first request to a proxied load balancer, a session key based on the configured HTTP headers (see `session_affinity_attributes.headers`) is generated, encoding the request headers used for storing in the load balancer session state which origin the request will be forwarded to. Subsequent requests to the load balancer with the same headers will be sent to the same origin server, for the duration of the session and as long as the origin server remains healthy. If the session has been idle for the duration of `session_affinity_ttl` seconds or the origin server is unhealthy, then a new origin server is calculated and used. See `headers` in `session_affinity_attributes` for additional required configuration.',choices:[`none`,`cookie`,`ip_cookie`,`header`]}).option(`session-affinity-attributes-drain-duration`,{type:`number`,description:`Configures the drain duration in seconds. This field is only used when session affinity is enabled on the load balancer.`}).option(`session-affinity-attributes-headers`,{type:`string`,array:!0,description:'Configures the names of HTTP headers to base session affinity on when header `session_affinity` is enabled. At least one HTTP header name must be provided. To specify the exact cookies to be used, include an item in the following format: `"cookie:<cookie-name-1>,<cookie-name-2>"` (example) where everything after the colon is a comma-separated list of cookie names. Providing only `"cookie"` will result in all cookies being used. The default max number of HTTP header names that can be provided depends on your plan: 5 for Enterprise, 1 for all other plans.'}).option(`session-affinity-attributes-require-all-headers`,{type:`boolean`,description:'When header `session_affinity` is enabled, this option can be used to specify how HTTP headers on load balancing requests will be used. The supported values are: - `"true"`: Load balancing requests must contain *all* of the HTTP headers specified by the `headers` session affinity attribute, otherwise sessions aren\'t created. - `"false"`: Load balancing requests must contain *at least one* of the HTTP headers specified by the `headers` session affinity attribute, otherwise sessions aren\'t created.'}).option(`session-affinity-attributes-samesite`,{type:`string`,description:`Configures the SameSite attribute on session affinity cookie. Value "Auto" will be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: when using value "None", the secure attribute can not be set to "Never".`,choices:[`Auto`,`Lax`,`None`,`Strict`]}).option(`session-affinity-attributes-secure`,{type:`string`,description:`Configures the Secure attribute on session affinity cookie. Value "Always" indicates the Secure attribute will be set in the Set-Cookie header, "Never" indicates the Secure attribute will not be set, and "Auto" will set the Secure attribute depending if Always Use HTTPS is enabled.`,choices:[`Auto`,`Always`,`Never`]}).option(`session-affinity-attributes-zero-downtime-failover`,{type:`string`,description:'Configures the zero-downtime failover between origins within a pool when session affinity is enabled. This feature is currently incompatible with Argo, Tiered Cache, and Bandwidth Alliance. The supported values are: - `"none"`: No failover takes place for sessions pinned to the origin (default). - `"temporary"`: Traffic will be sent to another other healthy origin until the originally pinned origin is available; note that this can potentially result in heavy origin flapping. - `"sticky"`: The session affinity cookie is updated and subsequent requests are sent to the new origin. Note: Zero-downtime failover with sticky sessions is currently not supported for session affinity by header.',choices:[`none`,`temporary`,`sticky`]}).option(`session-affinity-ttl`,{type:`number`,description:'Time, in seconds, until a client\'s session expires after being created. Once the expiry time has been reached, subsequent requests may get sent to a different origin server. The accepted ranges per `session_affinity` policy are: - `"cookie"` / `"ip_cookie"`: The current default of 23 hours will be used unless explicitly set. The accepted range of values is between [1800, 604800]. - `"header"`: The current default of 1800 seconds will be used unless explicitly set. The accepted range of values is between [30, 3600]. Note: With session affinity by header, sessions only expire after they haven\'t been used for the number of seconds specified.'}).option(`steering-policy`,{type:`string`,description:'Steering Policy for this load balancer.\n- `"off"`: Use `default_pools`.\n- `"geo"`: Use `region_pools`/`country_pools`/`pop_pools`. For non-proxied requests, the country for `country_pools` is determined by `location_strategy`.\n- `"random"`: Select a pool randomly.\n- `"dynamic_latency"`: Use round trip time to select the closest pool in default_pools (requires pool health checks).\n- `"proximity"`: Use the pools\' latitude and longitude to select the closest pool using the Cloudflare PoP location for proxied requests or the location determined by `location_strategy` for non-proxied requests.\n- `"least_outstanding_requests"`: Select a pool by taking into consideration `random_steering` weights, as well as each pool\'s number of outstanding requests. Pools with more pending requests are weighted proportionately less relative to others.\n- `"least_connections"`: Select a pool by taking into consideration `random_steering` weights, as well as each pool\'s number of open connections. Pools with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.\n- `""`: Will map to `"geo"` if you use `region_pools`/`country_pools`/`pop_pools` otherwise `"off"`.',choices:[`off`,`geo`,`random`,`dynamic_latency`,`proximity`,`least_outstanding_requests`,`least_connections`]}).option(`ttl`,{type:`number`,description:`Time to live (TTL) of the DNS entry for the IP address returned by this load balancer. This only applies to gray-clouded (unproxied) load balancers.`}).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 Be={command:`update <load-balancer-id>`,describe:`Update a configured load balancer.`,builder:ze,handler:async t=>{if(t.dryRun){l({command:`cf load-balancers update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/load_balancers/${t[`load-balancer-id`]==null?`<load-balancer-id>`:encodeURIComponent(String(t[`load-balancer-id`]))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"load-balancer-id":String(t[`load-balancer-id`]??``)},bodyKind:`json`,body:t.body===void 0?s({adaptive_routing:{failover_across_pools:t[`adaptive-routing-failover-across-pools`]},default_pools:t[`default-pools`],description:d(t.description,`description`,`text`),enabled:t.enabled,fallback_pool:d(t[`fallback-pool`],`fallback-pool`,`text`),location_strategy:{mode:d(t[`location-strategy-mode`],`location-strategy-mode`,`text`),prefer_ecs:d(t[`location-strategy-prefer-ecs`],`location-strategy-prefer-ecs`,`text`)},name:d(t.name,`name`,`text`),networks:t.networks,proxied:t.proxied,random_steering:{default_weight:t[`random-steering-default-weight`]},session_affinity:d(t[`session-affinity`],`session-affinity`,`text`),session_affinity_attributes:{drain_duration:t[`session-affinity-attributes-drain-duration`],headers:t[`session-affinity-attributes-headers`],require_all_headers:t[`session-affinity-attributes-require-all-headers`],samesite:d(t[`session-affinity-attributes-samesite`],`session-affinity-attributes-samesite`,`text`),secure:d(t[`session-affinity-attributes-secure`],`session-affinity-attributes-secure`,`text`),zero_downtime_failover:d(t[`session-affinity-attributes-zero-downtime-failover`],`session-affinity-attributes-zero-downtime-failover`,`text`)},session_affinity_ttl:t[`session-affinity-ttl`],steering_policy:d(t[`steering-policy`],`steering-policy`,`text`),ttl:t.ttl}):o(t.body)});return}let n=await a(t),r=await i({zone:t.zone},n,{quiet:t.quiet});if(t.zoneId=r,t.body){let e=o(t.body);c(await u(`Updating`,async()=>n.loadBalancers.update({...e,zone_id:r,load_balancer_id:t[`load-balancer-id`]})),{successLabel:`Updated`});return}if(t[`default-pools`]===void 0)throw Error(`--default-pools is required (or pass --body with this field set).`);t[`fallback-pool`]===void 0&&(t[`fallback-pool`]=await e(`fallback-pool`,`The pool ID to use when all other pools are detected as unhealthy.`)),t.name===void 0&&(t.name=await e(`name`,`The DNS hostname to associate with your Load Balancer. If this hostname already exists as a DNS record in Cloudflare's DNS, the Load Balancer will take precedence and the DNS record will not be used.`));let f=s({adaptive_routing:{failover_across_pools:t[`adaptive-routing-failover-across-pools`]},default_pools:t[`default-pools`],description:d(t.description,`description`,`text`),enabled:t.enabled,fallback_pool:d(t[`fallback-pool`],`fallback-pool`,`text`),location_strategy:{mode:d(t[`location-strategy-mode`],`location-strategy-mode`,`text`),prefer_ecs:d(t[`location-strategy-prefer-ecs`],`location-strategy-prefer-ecs`,`text`)},name:d(t.name,`name`,`text`),networks:t.networks,proxied:t.proxied,random_steering:{default_weight:t[`random-steering-default-weight`]},session_affinity:d(t[`session-affinity`],`session-affinity`,`text`),session_affinity_attributes:{drain_duration:t[`session-affinity-attributes-drain-duration`],headers:t[`session-affinity-attributes-headers`],require_all_headers:t[`session-affinity-attributes-require-all-headers`],samesite:d(t[`session-affinity-attributes-samesite`],`session-affinity-attributes-samesite`,`text`),secure:d(t[`session-affinity-attributes-secure`],`session-affinity-attributes-secure`,`text`),zero_downtime_failover:d(t[`session-affinity-attributes-zero-downtime-failover`],`session-affinity-attributes-zero-downtime-failover`,`text`)},session_affinity_ttl:t[`session-affinity-ttl`],steering_policy:d(t[`steering-policy`],`steering-policy`,`text`),ttl:t.ttl});c(await u(`Updating`,async()=>n.loadBalancers.update({...f,zone_id:r,load_balancer_id:t[`load-balancer-id`]})),{successLabel:`Updated`})}},Ve={command:`load-balancers`,describe:`Distribute traffic across origin pools with health monitoring, geo-steering, and failover`,builder:e=>e.command(ee).command(h).command(_).command(y).command(x).command(Be).command(L).command(ae).command(Oe).command(je).command(Fe).command(Re).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Ve as default};