From e11268b638a748f7a0f9213171d4bb771e0d6122 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C4=81vis=20Mos=C4=81ns?= Date: Fri, 11 Oct 2024 20:14:52 +0300 Subject: [PATCH] Implement `list_appliances` and `download_appliance` --- lib/fog/proxmox/storage.rb | 2 ++ .../storage/requests/download_appliance.rb | 24 +++++++++++++++++++ .../storage/requests/list_appliances.rb | 23 ++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 lib/fog/proxmox/storage/requests/download_appliance.rb create mode 100644 lib/fog/proxmox/storage/requests/list_appliances.rb diff --git a/lib/fog/proxmox/storage.rb b/lib/fog/proxmox/storage.rb index 446cec1..90fbf4e 100644 --- a/lib/fog/proxmox/storage.rb +++ b/lib/fog/proxmox/storage.rb @@ -31,6 +31,8 @@ class Storage < Fog::Service request_path 'fog/proxmox/storage/requests' request :upload + request :list_appliances + request :download_appliance # Mock class class Mock diff --git a/lib/fog/proxmox/storage/requests/download_appliance.rb b/lib/fog/proxmox/storage/requests/download_appliance.rb new file mode 100644 index 0000000..cf3bda8 --- /dev/null +++ b/lib/fog/proxmox/storage/requests/download_appliance.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Fog + module Proxmox + class Storage + # class Real download_appliance + class Real + def download_appliance(path_params, body_params) + node = path_params[:node] + request( + expects: [200], + method: 'POST', + path: "nodes/#{node}/aplinfo", + body: URI.encode_www_form(body_params) + ) + end + end + + # class Mock download_appliance + class Mock + end + end + end +end diff --git a/lib/fog/proxmox/storage/requests/list_appliances.rb b/lib/fog/proxmox/storage/requests/list_appliances.rb new file mode 100644 index 0000000..3af3e3b --- /dev/null +++ b/lib/fog/proxmox/storage/requests/list_appliances.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module Fog + module Proxmox + class Storage + # class Real list_appliances + class Real + def list_appliances(options) + node = options[:node] + request( + expects: [200], + method: 'GET', + path: "nodes/#{node}/aplinfo" + ) + end + end + + # class Mock list_appliances + class Mock + end + end + end +end