Your IP : 216.73.216.52


Current Path : /snap/lxd/38768/share/lxd-ui/assets/
Upload File :
Current File : //snap/lxd/38768/share/lxd-ui/assets/storage-volumes-CG043sqG.js

import{bD as m,R as p,O as h,dD as S,aQ as $,aS as g,aR as y,dE as u,cH as i,cI as R}from"./index-BsQN_SZU.js";const l=["can_delete","can_edit","can_manage_snapshots","can_manage_backups"],f=async(e,s,t)=>{const o=new URLSearchParams;return o.set("recursion","1"),o.set("project",s),i(o,t,l),fetch(`${p}/1.0/storage-pools/${encodeURIComponent(e)}/volumes?${o.toString()}`).then(h).then(n=>n.metadata.map(a=>({...a,pool:e})))},I=async(e,s)=>{const t=new URLSearchParams;return t.set("recursion","1"),t.set("project",e),i(t,s,l),fetch(`${p}/1.0/storage-volumes?${t.toString()}`).then(h).then(o=>o.metadata)},P=async(e,s,t,o,n,a)=>{const r=new URLSearchParams;return r.set("recursion","1"),r.set("project",s),m(r,n),i(r,a,l),fetch(`${p}/1.0/storage-pools/${encodeURIComponent(e)}/volumes/${encodeURIComponent(t)}/${encodeURIComponent(o)}?${r.toString()}`).then(R).then(c=>({...c,pool:e}))},j=async(e,s,t,o,n)=>{const a=new URLSearchParams;return a.set("project",s),a.set("recursion","1"),m(a,n),fetch(`${p}/1.0/storage-pools/${encodeURIComponent(e)}/volumes/${encodeURIComponent(t)}/${encodeURIComponent(o)}/state?${a.toString()}`).then(h).then(r=>r.metadata)},T=async(e,s,t,o=null)=>{const n=new URLSearchParams;return n.set("project",e),m(n,o),fetch(`${p}/1.0/storage-pools/${encodeURIComponent(s.pool)}/volumes/${encodeURIComponent(s.type)}/${encodeURIComponent(s.name)}?${n.toString()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t})}).then(h).then(a=>a)},L=async(e,s,t,o,n,a)=>{const r=new URLSearchParams;return r.set("project",o),u.post(`${p}/1.0/storage-pools/${encodeURIComponent(e)}/volumes/custom?${r.toString()}`,s,{headers:{"Content-Type":"application/octet-stream","X-LXD-name":t,"X-LXD-type":"iso"},onUploadProgress:c=>{n({percentage:c.progress?Math.floor(c.progress*100):0,loaded:c.loaded,total:c.total})},signal:a.signal}).then(c=>c.data)},V=async(e,s,t,o)=>{const n=new URLSearchParams;return n.set("project",s),m(n,o),fetch(`${p}/1.0/storage-pools/${encodeURIComponent(e)}/volumes?${n.toString()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(h).then(a=>a)},w=async(e,s,t,o)=>{const n=new URLSearchParams;return n.set("project",s),m(n,o),fetch(`${p}/1.0/storage-pools/${encodeURIComponent(e)}/volumes/${encodeURIComponent(t.type)}/${encodeURIComponent(t.name)}?${n.toString()}`,{method:"PUT",body:JSON.stringify(t),headers:{"Content-Type":"application/json","If-Match":t.etag??"invalid-etag"}}).then(h).then(a=>a)},U=async(e,s,t,o)=>{const n=new URLSearchParams;return n.set("project",t),m(n,o),fetch(`${p}/1.0/storage-pools/${encodeURIComponent(s)}/volumes/custom/${encodeURIComponent(e)}?${n.toString()}`,{method:"DELETE"}).then(h).then(a=>a)},O=async(e,s)=>{const t=[];return new Promise((o,n)=>{Promise.allSettled(e.map(async a=>{const r={name:a.name,type:"volume",href:S(a)};return U(a.name,a.pool,s,a.location).then(()=>{$(t,r),g(t,e.length,o)}).catch(c=>{y(t,c instanceof Error?c.message:"",r),g(t,e.length,o)})})).catch(n)})},b=async(e,s,t,o,n)=>{const a=new URLSearchParams;return a.set("project",s),m(a,o),fetch(`${p}/1.0/storage-pools/${encodeURIComponent(e.pool)}/volumes/custom/${encodeURIComponent(e.name)}?${a.toString()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:n,name:e.name,pool:t??e.pool})}).then(h).then(r=>r)},_=(e,s,t,o=!1)=>({name:s,type:"custom",config:e.config,description:e.description,content_type:e.content_type,source:{name:e.name,type:"copy",pool:e.pool,volume_only:o,project:t!==e.project?e.project:void 0,location:e.location}}),E=async(e,s,t,o)=>{const n=new URLSearchParams;return t&&n.append("project",t),m(n,o),fetch(`${p}/1.0/storage-pools/${encodeURIComponent(s)}/volumes/custom?${n.toString()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(h).then(a=>a)},D=async(e,s)=>{const t=new URLSearchParams;return t.set("project",e.project),m(t,e.location),fetch(`${p}/1.0/storage-pools/${encodeURIComponent(e.pool)}/volumes/${encodeURIComponent(e.type)}/${encodeURIComponent(e.name)}/backups?${t.toString()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:s}).then(h).then(o=>o)},k=async(e,s,t,o,n,a,r)=>{const c=new URLSearchParams;return c.set("project",t),m(c,r),u.post(`${p}/1.0/storage-pools/${encodeURIComponent(o)}/volumes/custom?${c.toString()}`,e,{headers:{"Content-Type":"application/octet-stream","X-LXD-name":s},onUploadProgress:d=>{n({percentage:d.progress?Math.floor(d.progress*100):0,loaded:d.loaded,total:d.total})},signal:a.signal}).then(d=>d.data)};export{L as a,f as b,V as c,P as d,O as e,I as f,j as g,U as h,_ as i,E as j,D as k,w as l,b as m,T as r,k as u};