| Current Path : /snap/lxd/38768/share/lxd-ui/assets/ |
| Current File : //snap/lxd/38768/share/lxd-ui/assets/network-forwards-CAuMAfcF.js |
import{bD as c,R as r,c1 as i,O as d}from"./index-BsQN_SZU.js";const m=async(a,t)=>{const o=new URLSearchParams;return o.set("project",t),o.set("recursion","1"),fetch(`${r}/1.0/networks/${encodeURIComponent(a)}/forwards?${o.toString()}`).then(d).then(e=>e.metadata.sort((n,s)=>n.listen_address.localeCompare(s.listen_address)*10+(n.location&&s.location?n.location.localeCompare(s.location):0)))},l=async(a,t,o,e)=>{const n=new URLSearchParams;return n.set("project",o),n.set("recursion","1"),c(n,e),fetch(`${r}/1.0/networks/${encodeURIComponent(a)}/forwards/${encodeURIComponent(t)}?${n.toString()}`).then(d).then(s=>s.metadata)},w=async(a,t,o)=>{const e=new URLSearchParams;return e.set("project",o),c(e,t.location),fetch(`${r}/1.0/networks/${encodeURIComponent(a)}/forwards?${e.toString()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(i).then(n=>n.headers.get("Location")?.split("/").pop()??"")},R=async(a,t,o)=>{const e=new URLSearchParams;e.set("project",o),c(e,t.location),await fetch(`${r}/1.0/networks/${encodeURIComponent(a)}/forwards/${encodeURIComponent(t.listen_address)}?${e.toString()}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(d)},$=async(a,t,o)=>{const e=new URLSearchParams;e.set("project",o),c(e,t.location),await fetch(`${r}/1.0/networks/${encodeURIComponent(a.name)}/forwards/${encodeURIComponent(t.listen_address)}?${e.toString()}`,{method:"DELETE"}).then(d)};export{m as a,w as c,$ as d,l as f,R as u};