%PDF- %PDF-
Direktori : /proc/self/root/snap/lxd/29351/share/lxd-ui/assets/ |
Current File : //proc/self/root/snap/lxd/29351/share/lxd-ui/assets/networks-5caac489.js |
import{v as o,bf as w,bg as u}from"./index-13b2882d.js";const p=e=>new Promise((t,a)=>{fetch(`/1.0/networks?project=${e}&recursion=1`).then(o).then(s=>t(s.metadata)).catch(a)}),i=(e,t)=>new Promise((a,s)=>{fetch(`/1.0/networks/${e}?project=${t}`).then(u).then(n=>a(n)).catch(s)}),N=(e,t)=>new Promise((a,s)=>{fetch(`/1.0/networks/${e}/state?project=${t}`).then(o).then(n=>a(n.metadata)).catch(s)}),g=(e,t,a)=>new Promise((s,n)=>{const c={name:e.name,description:e.description,type:e.type};Promise.allSettled(a.map(async r=>{await m(c,t,r.server_name)})).then(r=>{var f;const h=(f=r.find(d=>d.status==="rejected"))==null?void 0:f.reason;if(h){n(h);return}m(e,t).then(s).catch(n)}).catch(n)}),m=(e,t,a)=>new Promise((s,n)=>{const c=a?`&target=${a}`:"";fetch(`/1.0/networks?project=${t}${c}`,{method:"POST",body:JSON.stringify(e)}).then(o).then(r=>s(r)).catch(async r=>{if(r.message==="Failed to fetch"){const h=await i(e.name??"",t);h&&s(h)}n(r)})}),y=(e,t)=>new Promise((a,s)=>{fetch(`/1.0/networks/${e.name??""}?project=${t}`,{method:"PUT",body:JSON.stringify(e),headers:{"If-Match":e.etag??"invalid-etag"}}).then(o).then(n=>a(n)).catch(async n=>{if(n.message==="Failed to fetch"){const c=await i(e.name??"",t);w(e,c)&&a(c)}s(n)})}),P=(e,t,a)=>new Promise((s,n)=>{fetch(`/1.0/networks/${e}?project=${a}`,{method:"POST",body:JSON.stringify({name:t})}).then(o).then(s).catch(async c=>{if(c.message==="Failed to fetch"){const r=await i(t,a);r&&s(r)}n(c)})}),k=(e,t)=>new Promise((a,s)=>{fetch(`/1.0/networks/${e}?project=${t}`,{method:"DELETE"}).then(o).then(a).catch(async n=>{n.message==="Failed to fetch"&&(await fetch(`/1.0/networks/${e}?project=${t}`)).status===404&&a(),s(n)})});export{m as a,N as b,g as c,k as d,i as e,p as f,P as r,y as u};