fog-proxmox 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.bundle/config +4 -0
- data/.codeclimate.yml +14 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +35 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +17 -0
- data/.gitignore +5 -0
- data/.gitlab-ci.yml +42 -0
- data/.rubocop.yml +13 -0
- data/.ruby-gemset +1 -0
- data/.solargraph.yml +10 -0
- data/.travis.yml +26 -0
- data/.vscode/launch.json +114 -0
- data/.vscode/settings.json +45 -0
- data/.vscode/tasks.json +27 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/CONTRIBUTING.md +20 -0
- data/CONTRIBUTORS.md +9 -0
- data/Gemfile +23 -0
- data/Gemfile.lock +146 -0
- data/ISSUE_TEMPLATE.md +43 -0
- data/LICENSE +674 -0
- data/README.md +58 -0
- data/Rakefile +53 -0
- data/SUPPORT.md +9 -0
- data/bin/console +29 -0
- data/bin/setup +29 -0
- data/docs/compute.md +846 -0
- data/docs/connection_parameters.md +45 -0
- data/docs/getting_started.md +53 -0
- data/docs/identity.md +357 -0
- data/examples/compute.rb +279 -0
- data/examples/identity.rb +195 -0
- data/fog-proxmox.gemspec +63 -0
- data/fogproxmox.png +0 -0
- data/lib/fog/compute/proxmox.rb +131 -0
- data/lib/fog/compute/proxmox/models/container.rb +97 -0
- data/lib/fog/compute/proxmox/models/container_config.rb +90 -0
- data/lib/fog/compute/proxmox/models/containers.rb +40 -0
- data/lib/fog/compute/proxmox/models/disk.rb +67 -0
- data/lib/fog/compute/proxmox/models/disks.rb +49 -0
- data/lib/fog/compute/proxmox/models/interface.rb +50 -0
- data/lib/fog/compute/proxmox/models/interfaces.rb +46 -0
- data/lib/fog/compute/proxmox/models/node.rb +93 -0
- data/lib/fog/compute/proxmox/models/nodes.rb +45 -0
- data/lib/fog/compute/proxmox/models/server.rb +212 -0
- data/lib/fog/compute/proxmox/models/server_config.rb +116 -0
- data/lib/fog/compute/proxmox/models/servers.rb +70 -0
- data/lib/fog/compute/proxmox/models/snapshot.rb +70 -0
- data/lib/fog/compute/proxmox/models/snapshots.rb +55 -0
- data/lib/fog/compute/proxmox/models/storage.rb +61 -0
- data/lib/fog/compute/proxmox/models/storages.rb +60 -0
- data/lib/fog/compute/proxmox/models/task.rb +84 -0
- data/lib/fog/compute/proxmox/models/tasks.rb +71 -0
- data/lib/fog/compute/proxmox/models/volume.rb +61 -0
- data/lib/fog/compute/proxmox/models/volumes.rb +67 -0
- data/lib/fog/compute/proxmox/requests/action_server.rb +47 -0
- data/lib/fog/compute/proxmox/requests/check_vmid.rb +41 -0
- data/lib/fog/compute/proxmox/requests/clone_server.rb +46 -0
- data/lib/fog/compute/proxmox/requests/create_backup.rb +44 -0
- data/lib/fog/compute/proxmox/requests/create_server.rb +45 -0
- data/lib/fog/compute/proxmox/requests/create_snapshot.rb +47 -0
- data/lib/fog/compute/proxmox/requests/create_spice.rb +46 -0
- data/lib/fog/compute/proxmox/requests/create_term.rb +46 -0
- data/lib/fog/compute/proxmox/requests/create_vnc.rb +46 -0
- data/lib/fog/compute/proxmox/requests/delete_server.rb +47 -0
- data/lib/fog/compute/proxmox/requests/delete_snapshot.rb +48 -0
- data/lib/fog/compute/proxmox/requests/delete_volume.rb +40 -0
- data/lib/fog/compute/proxmox/requests/get_node.rb +44 -0
- data/lib/fog/compute/proxmox/requests/get_server_config.rb +45 -0
- data/lib/fog/compute/proxmox/requests/get_server_status.rb +45 -0
- data/lib/fog/compute/proxmox/requests/get_snapshot.rb +47 -0
- data/lib/fog/compute/proxmox/requests/get_storage.rb +44 -0
- data/lib/fog/compute/proxmox/requests/get_task.rb +44 -0
- data/lib/fog/compute/proxmox/requests/get_vnc.rb +46 -0
- data/lib/fog/compute/proxmox/requests/get_volume.rb +42 -0
- data/lib/fog/compute/proxmox/requests/list_nodes.rb +42 -0
- data/lib/fog/compute/proxmox/requests/list_servers.rb +42 -0
- data/lib/fog/compute/proxmox/requests/list_snapshots.rb +43 -0
- data/lib/fog/compute/proxmox/requests/list_storages.rb +42 -0
- data/lib/fog/compute/proxmox/requests/list_tasks.rb +42 -0
- data/lib/fog/compute/proxmox/requests/list_volumes.rb +42 -0
- data/lib/fog/compute/proxmox/requests/log_task.rb +45 -0
- data/lib/fog/compute/proxmox/requests/migrate_server.rb +44 -0
- data/lib/fog/compute/proxmox/requests/move_disk.rb +46 -0
- data/lib/fog/compute/proxmox/requests/move_volume.rb +46 -0
- data/lib/fog/compute/proxmox/requests/next_vmid.rb +39 -0
- data/lib/fog/compute/proxmox/requests/resize_container.rb +46 -0
- data/lib/fog/compute/proxmox/requests/resize_server.rb +43 -0
- data/lib/fog/compute/proxmox/requests/rollback_snapshot.rb +46 -0
- data/lib/fog/compute/proxmox/requests/status_task.rb +44 -0
- data/lib/fog/compute/proxmox/requests/stop_task.rb +41 -0
- data/lib/fog/compute/proxmox/requests/template_server.rb +43 -0
- data/lib/fog/compute/proxmox/requests/update_server.rb +46 -0
- data/lib/fog/compute/proxmox/requests/update_snapshot.rb +45 -0
- data/lib/fog/identity/proxmox.rb +132 -0
- data/lib/fog/identity/proxmox/models/activedirectory.rb +57 -0
- data/lib/fog/identity/proxmox/models/domain.rb +61 -0
- data/lib/fog/identity/proxmox/models/domains.rb +115 -0
- data/lib/fog/identity/proxmox/models/group.rb +60 -0
- data/lib/fog/identity/proxmox/models/groups.rb +50 -0
- data/lib/fog/identity/proxmox/models/ldap.rb +57 -0
- data/lib/fog/identity/proxmox/models/oath.rb +50 -0
- data/lib/fog/identity/proxmox/models/pam.rb +46 -0
- data/lib/fog/identity/proxmox/models/permission.rb +69 -0
- data/lib/fog/identity/proxmox/models/permissions.rb +61 -0
- data/lib/fog/identity/proxmox/models/pool.rb +84 -0
- data/lib/fog/identity/proxmox/models/pools.rb +50 -0
- data/lib/fog/identity/proxmox/models/principal.rb +47 -0
- data/lib/fog/identity/proxmox/models/pve.rb +46 -0
- data/lib/fog/identity/proxmox/models/role.rb +61 -0
- data/lib/fog/identity/proxmox/models/roles.rb +51 -0
- data/lib/fog/identity/proxmox/models/user.rb +74 -0
- data/lib/fog/identity/proxmox/models/users.rb +50 -0
- data/lib/fog/identity/proxmox/models/yubico.rb +51 -0
- data/lib/fog/identity/proxmox/requests/add_permission.rb +41 -0
- data/lib/fog/identity/proxmox/requests/change_password.rb +41 -0
- data/lib/fog/identity/proxmox/requests/check_permissions.rb +44 -0
- data/lib/fog/identity/proxmox/requests/create_domain.rb +40 -0
- data/lib/fog/identity/proxmox/requests/create_group.rb +40 -0
- data/lib/fog/identity/proxmox/requests/create_pool.rb +40 -0
- data/lib/fog/identity/proxmox/requests/create_role.rb +40 -0
- data/lib/fog/identity/proxmox/requests/create_user.rb +40 -0
- data/lib/fog/identity/proxmox/requests/delete_domain.rb +40 -0
- data/lib/fog/identity/proxmox/requests/delete_group.rb +40 -0
- data/lib/fog/identity/proxmox/requests/delete_pool.rb +39 -0
- data/lib/fog/identity/proxmox/requests/delete_role.rb +40 -0
- data/lib/fog/identity/proxmox/requests/delete_user.rb +39 -0
- data/lib/fog/identity/proxmox/requests/get_domain.rb +41 -0
- data/lib/fog/identity/proxmox/requests/get_group.rb +41 -0
- data/lib/fog/identity/proxmox/requests/get_pool.rb +41 -0
- data/lib/fog/identity/proxmox/requests/get_role.rb +41 -0
- data/lib/fog/identity/proxmox/requests/get_user.rb +40 -0
- data/lib/fog/identity/proxmox/requests/list_domains.rb +41 -0
- data/lib/fog/identity/proxmox/requests/list_groups.rb +41 -0
- data/lib/fog/identity/proxmox/requests/list_permissions.rb +41 -0
- data/lib/fog/identity/proxmox/requests/list_pools.rb +41 -0
- data/lib/fog/identity/proxmox/requests/list_roles.rb +41 -0
- data/lib/fog/identity/proxmox/requests/list_users.rb +42 -0
- data/lib/fog/identity/proxmox/requests/read_version.rb +43 -0
- data/lib/fog/identity/proxmox/requests/remove_permission.rb +42 -0
- data/lib/fog/identity/proxmox/requests/update_domain.rb +41 -0
- data/lib/fog/identity/proxmox/requests/update_group.rb +41 -0
- data/lib/fog/identity/proxmox/requests/update_pool.rb +41 -0
- data/lib/fog/identity/proxmox/requests/update_role.rb +41 -0
- data/lib/fog/identity/proxmox/requests/update_user.rb +41 -0
- data/lib/fog/network/proxmox.rb +83 -0
- data/lib/fog/network/proxmox/models/network.rb +82 -0
- data/lib/fog/network/proxmox/models/networks.rb +54 -0
- data/lib/fog/network/proxmox/models/node.rb +70 -0
- data/lib/fog/network/proxmox/models/nodes.rb +45 -0
- data/lib/fog/network/proxmox/requests/create_network.rb +44 -0
- data/lib/fog/network/proxmox/requests/delete_network.rb +45 -0
- data/lib/fog/network/proxmox/requests/get_network.rb +46 -0
- data/lib/fog/network/proxmox/requests/get_node.rb +44 -0
- data/lib/fog/network/proxmox/requests/list_networks.rb +43 -0
- data/lib/fog/network/proxmox/requests/list_nodes.rb +42 -0
- data/lib/fog/network/proxmox/requests/power_node.rb +46 -0
- data/lib/fog/network/proxmox/requests/update_network.rb +46 -0
- data/lib/fog/proxmox.rb +128 -0
- data/lib/fog/proxmox/core.rb +139 -0
- data/lib/fog/proxmox/errors.rb +64 -0
- data/lib/fog/proxmox/hash.rb +33 -0
- data/lib/fog/proxmox/helpers/controller_helper.rb +55 -0
- data/lib/fog/proxmox/helpers/cpu_helper.rb +45 -0
- data/lib/fog/proxmox/helpers/disk_helper.rb +84 -0
- data/lib/fog/proxmox/helpers/nic_helper.rb +62 -0
- data/lib/fog/proxmox/json.rb +32 -0
- data/lib/fog/proxmox/models/collection.rb +85 -0
- data/lib/fog/proxmox/models/model.rb +58 -0
- data/lib/fog/proxmox/variables.rb +40 -0
- data/lib/fog/proxmox/version.rb +24 -0
- data/lib/fog/storage/proxmox.rb +29 -0
- data/spec/compute_spec.rb +408 -0
- data/spec/fixtures/proxmox/compute/containers.yml +5398 -0
- data/spec/fixtures/proxmox/compute/identity_ticket.yml +40 -0
- data/spec/fixtures/proxmox/compute/servers.yml +10571 -0
- data/spec/fixtures/proxmox/compute/snapshots.yml +1228 -0
- data/spec/fixtures/proxmox/compute/storages.yml +120 -0
- data/spec/fixtures/proxmox/compute/tasks.yml +200 -0
- data/spec/fixtures/proxmox/identity/auth.yml +44 -0
- data/spec/fixtures/proxmox/identity/domains.yml +531 -0
- data/spec/fixtures/proxmox/identity/groups.yml +324 -0
- data/spec/fixtures/proxmox/identity/identity_ticket.yml +40 -0
- data/spec/fixtures/proxmox/identity/permissions.yml +565 -0
- data/spec/fixtures/proxmox/identity/pools.yml +488 -0
- data/spec/fixtures/proxmox/identity/read_version.yml +42 -0
- data/spec/fixtures/proxmox/identity/roles.yml +324 -0
- data/spec/fixtures/proxmox/identity/users.yml +646 -0
- data/spec/fixtures/proxmox/network/identity_ticket.yml +40 -0
- data/spec/fixtures/proxmox/network/networks.yml +413 -0
- data/spec/helpers/controller_helper_spec.rb +77 -0
- data/spec/helpers/cpu_helper_spec.rb +91 -0
- data/spec/helpers/disk_helper_spec.rb +104 -0
- data/spec/helpers/nic_helper_spec.rb +73 -0
- data/spec/identity_spec.rb +316 -0
- data/spec/network_spec.rb +67 -0
- data/spec/proxmox_vcr.rb +102 -0
- data/spec/spec_helper.rb +39 -0
- metadata +535 -0
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2018 Tristan Robert
|
4
|
+
|
5
|
+
# This file is part of Fog::Proxmox.
|
6
|
+
|
7
|
+
# Fog::Proxmox is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
|
12
|
+
# Fog::Proxmox is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with Fog::Proxmox. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
module Fog
|
21
|
+
module Compute
|
22
|
+
class Proxmox
|
23
|
+
# class Real migrate_server request
|
24
|
+
class Real
|
25
|
+
def migrate_server(path_params, body_params)
|
26
|
+
node = path_params[:node]
|
27
|
+
type = path_params[:type]
|
28
|
+
vmid = path_params[:vmid]
|
29
|
+
request(
|
30
|
+
expects: [200],
|
31
|
+
method: 'POST',
|
32
|
+
path: "nodes/#{node}/#{type}/#{vmid}/migrate",
|
33
|
+
body: URI.encode_www_form(body_params)
|
34
|
+
)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# class Mock migrate_server request
|
39
|
+
class Mock
|
40
|
+
def migrate_server; end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2018 Tristan Robert
|
4
|
+
|
5
|
+
# This file is part of Fog::Proxmox.
|
6
|
+
|
7
|
+
# Fog::Proxmox is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
|
12
|
+
# Fog::Proxmox is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with Fog::Proxmox. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
require 'fog/proxmox/json'
|
21
|
+
|
22
|
+
module Fog
|
23
|
+
module Compute
|
24
|
+
class Proxmox
|
25
|
+
# class Real move_disk request
|
26
|
+
class Real
|
27
|
+
def move_disk(path_params, body_params)
|
28
|
+
node = path_params[:node]
|
29
|
+
vmid = path_params[:vmid]
|
30
|
+
response = request(
|
31
|
+
expects: [200],
|
32
|
+
method: 'POST',
|
33
|
+
path: "nodes/#{node}/qemu/#{vmid}/move_disk",
|
34
|
+
body: URI.encode_www_form(body_params)
|
35
|
+
)
|
36
|
+
Fog::Proxmox::Json.get_data(response)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# class Mock move_disk request
|
41
|
+
class Mock
|
42
|
+
def move_disk; end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2018 Tristan Robert
|
4
|
+
|
5
|
+
# This file is part of Fog::Proxmox.
|
6
|
+
|
7
|
+
# Fog::Proxmox is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
|
12
|
+
# Fog::Proxmox is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with Fog::Proxmox. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
require 'fog/proxmox/json'
|
21
|
+
|
22
|
+
module Fog
|
23
|
+
module Compute
|
24
|
+
class Proxmox
|
25
|
+
# class Real move_volume request
|
26
|
+
class Real
|
27
|
+
def move_volume(path_params, body_params)
|
28
|
+
node = path_params[:node]
|
29
|
+
vmid = path_params[:vmid]
|
30
|
+
response = request(
|
31
|
+
expects: [200],
|
32
|
+
method: 'POST',
|
33
|
+
path: "nodes/#{node}/lxc/#{vmid}/move_volume",
|
34
|
+
body: URI.encode_www_form(body_params)
|
35
|
+
)
|
36
|
+
Fog::Proxmox::Json.get_data(response)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# class Mock move_volume request
|
41
|
+
class Mock
|
42
|
+
def move_volume; end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2018 Tristan Robert
|
4
|
+
|
5
|
+
# This file is part of Fog::Proxmox.
|
6
|
+
|
7
|
+
# Fog::Proxmox is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
|
12
|
+
# Fog::Proxmox is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with Fog::Proxmox. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
module Fog
|
21
|
+
module Compute
|
22
|
+
class Proxmox
|
23
|
+
# class Real next_vmid collection
|
24
|
+
class Real
|
25
|
+
def next_vmid
|
26
|
+
request(
|
27
|
+
expects: [200],
|
28
|
+
method: 'GET',
|
29
|
+
path: 'cluster/nextid'
|
30
|
+
)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# class Mock next_vmid collection
|
35
|
+
class Mock
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2018 Tristan Robert
|
4
|
+
|
5
|
+
# This file is part of Fog::Proxmox.
|
6
|
+
|
7
|
+
# Fog::Proxmox is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
|
12
|
+
# Fog::Proxmox is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with Fog::Proxmox. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
require 'fog/proxmox/json'
|
21
|
+
|
22
|
+
module Fog
|
23
|
+
module Compute
|
24
|
+
class Proxmox
|
25
|
+
# class Real resize_container request
|
26
|
+
class Real
|
27
|
+
def resize_container(path_params, body_params)
|
28
|
+
node = path_params[:node]
|
29
|
+
vmid = path_params[:vmid]
|
30
|
+
response = request(
|
31
|
+
expects: [200],
|
32
|
+
method: 'PUT',
|
33
|
+
path: "nodes/#{node}/lxc/#{vmid}/resize",
|
34
|
+
body: URI.encode_www_form(body_params)
|
35
|
+
)
|
36
|
+
Fog::Proxmox::Json.get_data(response)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# class Mock resize_container request
|
41
|
+
class Mock
|
42
|
+
def resize_container; end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2018 Tristan Robert
|
4
|
+
|
5
|
+
# This file is part of Fog::Proxmox.
|
6
|
+
|
7
|
+
# Fog::Proxmox is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
|
12
|
+
# Fog::Proxmox is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with Fog::Proxmox. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
module Fog
|
21
|
+
module Compute
|
22
|
+
class Proxmox
|
23
|
+
# class Real resize_server request
|
24
|
+
class Real
|
25
|
+
def resize_server(path_params, body_params)
|
26
|
+
node = path_params[:node]
|
27
|
+
vmid = path_params[:vmid]
|
28
|
+
request(
|
29
|
+
expects: [200],
|
30
|
+
method: 'PUT',
|
31
|
+
path: "nodes/#{node}/qemu/#{vmid}/resize",
|
32
|
+
body: URI.encode_www_form(body_params)
|
33
|
+
)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# class Mock resize_server request
|
38
|
+
class Mock
|
39
|
+
def resize_server; end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2018 Tristan Robert
|
4
|
+
|
5
|
+
# This file is part of Fog::Proxmox.
|
6
|
+
|
7
|
+
# Fog::Proxmox is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
|
12
|
+
# Fog::Proxmox is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with Fog::Proxmox. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
# frozen_string_literal: true
|
21
|
+
|
22
|
+
module Fog
|
23
|
+
module Compute
|
24
|
+
class Proxmox
|
25
|
+
# class Real rollback_snapshot request
|
26
|
+
class Real
|
27
|
+
def rollback_snapshot(path_params)
|
28
|
+
node = path_params[:node]
|
29
|
+
type = path_params[:type]
|
30
|
+
vmid = path_params[:vmid]
|
31
|
+
snapname = path_params[:snapname]
|
32
|
+
request(
|
33
|
+
expects: [200],
|
34
|
+
method: 'POST',
|
35
|
+
path: "nodes/#{node}/#{type}/#{vmid}/snapshot/#{snapname}/rollback"
|
36
|
+
)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# class Mock rollback_snapshot request
|
41
|
+
class Mock
|
42
|
+
def rollback_snapshot; end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# Copyright 2018 Tristan Robert
|
3
|
+
|
4
|
+
# This file is part of Fog::Proxmox.
|
5
|
+
|
6
|
+
# Fog::Proxmox is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
|
11
|
+
# Fog::Proxmox is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with Fog::Proxmox. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
|
19
|
+
# frozen_string_literal: true
|
20
|
+
|
21
|
+
require 'fog/proxmox/json'
|
22
|
+
|
23
|
+
module Fog
|
24
|
+
module Compute
|
25
|
+
class Proxmox
|
26
|
+
# class Real status_task
|
27
|
+
class Real
|
28
|
+
def status_task(node, upid)
|
29
|
+
response = request(
|
30
|
+
expects: [200],
|
31
|
+
method: 'GET',
|
32
|
+
path: "nodes/#{node}/tasks/#{upid}/status"
|
33
|
+
)
|
34
|
+
Fog::Proxmox::Json.get_data(response)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# class Mock status_task
|
39
|
+
class Mock
|
40
|
+
def status_task(node, upid); end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# Copyright 2018 Tristan Robert
|
3
|
+
|
4
|
+
# This file is part of Fog::Proxmox.
|
5
|
+
|
6
|
+
# Fog::Proxmox is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
|
11
|
+
# Fog::Proxmox is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with Fog::Proxmox. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
|
19
|
+
# frozen_string_literal: true
|
20
|
+
|
21
|
+
module Fog
|
22
|
+
module Compute
|
23
|
+
class Proxmox
|
24
|
+
# class Real stop_task collection
|
25
|
+
class Real
|
26
|
+
def stop_task(node, upid)
|
27
|
+
request(
|
28
|
+
expects: [200],
|
29
|
+
method: 'DELETE',
|
30
|
+
path: "nodes/#{node}/tasks/#{upid}"
|
31
|
+
)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# class Mock get_task collection
|
36
|
+
class Mock
|
37
|
+
def stop_task(taskid); end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2018 Tristan Robert
|
4
|
+
|
5
|
+
# This file is part of Fog::Proxmox.
|
6
|
+
|
7
|
+
# Fog::Proxmox is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
|
12
|
+
# Fog::Proxmox is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with Fog::Proxmox. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
module Fog
|
21
|
+
module Compute
|
22
|
+
class Proxmox
|
23
|
+
# class Real template_server request
|
24
|
+
class Real
|
25
|
+
def template_server(path_params, body_params)
|
26
|
+
node = path_params[:node]
|
27
|
+
type = path_params[:type]
|
28
|
+
vmid = path_params[:vmid]
|
29
|
+
request(
|
30
|
+
expects: [200],
|
31
|
+
method: 'POST',
|
32
|
+
path: "nodes/#{node}/#{type}/#{vmid}/template",
|
33
|
+
body: URI.encode_www_form(body_params)
|
34
|
+
)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# class Mock template_server request
|
39
|
+
class Mock
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|