const ClusterDownloadSet = { props: [ 'cluster', 'token', 'state' ], data() { return { signReqValidity: "1d", downloadSet: null, }; }, methods: { generateDownloadSet() { event.preventDefault() const hosts = (this.state.Hosts||[]).filter(h => h.Cluster == this.cluster.Name) const items = hosts.map(h => ({ Kind: "host", Name: h.Name, Assets: ["kernel", "initrd", "uki", "bootstrap.tar", "boot.img.gz", "boot.img", "boot.qcow2", "boot.iso", "boot.tar", "bootstrap-config", "config", "config.json", "ipxe"], })) fetch('/sign-download-set', { method: 'POST', body: JSON.stringify({Expiry: this.signReqValidity, Items: items}), headers: { 'Authorization': 'Bearer ' + this.token, 'Content-Type': 'application/json' }, }).then((resp) => { if (resp.ok) { resp.json().then((set) => { this.downloadSet = set }) } else { resp.json().then((resp) => alert('failed to generate: '+resp.message)) } }).catch((e) => { alert('failed to generate: '+e) }) }, }, template: `
Validity: time range, ie: -5m:1w, 5m, 1M, 1y, 1d-1s, etc.
` }