From 799beb9eee61f4a94f0d9742f8c0f8fbc99389cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alp=20Eren=20=C3=87elik?= <80721144+alperencelik@users.noreply.github.com> Date: Tue, 5 Mar 2024 23:31:57 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8feat:=20Add=20ConvertToTemplate=20meth?= =?UTF-8?q?od=20(#122)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ✨feat: Add DeleteContent method for storage * ✨feat: Add ConvertToTemplate method --- virtual_machine.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/virtual_machine.go b/virtual_machine.go index 56fa971..06b9038 100644 --- a/virtual_machine.go +++ b/virtual_machine.go @@ -635,3 +635,11 @@ func (v *VirtualMachine) RRDData(ctx context.Context, timeframe Timeframe, conso err = v.client.Get(ctx, u.String(), &rrddata) return } + +func (v *VirtualMachine) ConvertToTemplate(ctx context.Context) (task *Task, err error) { + var upid UPID + if err = v.client.Post(ctx, fmt.Sprintf("/nodes/%s/qemu/%d/template", v.Node, v.VMID), nil, &upid); err != nil { + return nil, err + } + return NewTask(upid, v.client), nil +}