fog-proxmox 0.5.5 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/.gitlab-ci.yml +7 -0
  3. data/.travis.yml +1 -0
  4. data/.vscode/launch.json +3 -21
  5. data/.vscode/settings.json +7 -7
  6. data/Gemfile.lock +39 -39
  7. data/README.md +9 -2
  8. data/examples/compute.rb +20 -23
  9. data/examples/identity.rb +16 -21
  10. data/fog-proxmox.gemspec +1 -2
  11. data/lib/fog/compute/proxmox.rb +2 -8
  12. data/lib/fog/compute/proxmox/models/disk.rb +13 -11
  13. data/lib/fog/compute/proxmox/models/disks.rb +3 -5
  14. data/lib/fog/compute/proxmox/models/interface.rb +6 -11
  15. data/lib/fog/compute/proxmox/models/interfaces.rb +3 -5
  16. data/lib/fog/compute/proxmox/models/node.rb +38 -43
  17. data/lib/fog/compute/proxmox/models/nodes.rb +5 -11
  18. data/lib/fog/compute/proxmox/models/server.rb +123 -80
  19. data/lib/fog/compute/proxmox/models/server_config.rb +56 -24
  20. data/lib/fog/compute/proxmox/models/servers.rb +34 -26
  21. data/lib/fog/compute/proxmox/models/snapshot.rb +28 -14
  22. data/lib/fog/compute/proxmox/models/snapshots.rb +9 -17
  23. data/lib/fog/compute/proxmox/models/storage.rb +15 -11
  24. data/lib/fog/compute/proxmox/models/storages.rb +13 -22
  25. data/lib/fog/compute/proxmox/models/task.rb +10 -14
  26. data/lib/fog/compute/proxmox/models/tasks.rb +9 -18
  27. data/lib/fog/compute/proxmox/models/volume.rb +12 -12
  28. data/lib/fog/compute/proxmox/models/volumes.rb +10 -19
  29. data/lib/fog/compute/proxmox/requests/action_server.rb +1 -4
  30. data/lib/fog/compute/proxmox/requests/clone_server.rb +1 -4
  31. data/lib/fog/compute/proxmox/requests/create_backup.rb +1 -4
  32. data/lib/fog/compute/proxmox/requests/create_server.rb +1 -4
  33. data/lib/fog/compute/proxmox/requests/create_snapshot.rb +1 -4
  34. data/lib/fog/compute/proxmox/requests/create_spice.rb +1 -4
  35. data/lib/fog/compute/proxmox/requests/create_term.rb +1 -4
  36. data/lib/fog/compute/proxmox/requests/create_vnc.rb +1 -4
  37. data/lib/fog/compute/proxmox/requests/delete_server.rb +1 -4
  38. data/lib/fog/compute/proxmox/requests/delete_snapshot.rb +1 -4
  39. data/lib/fog/compute/proxmox/requests/get_node_statistics.rb +1 -4
  40. data/lib/fog/compute/proxmox/requests/get_server_config.rb +1 -4
  41. data/lib/fog/compute/proxmox/requests/get_server_status.rb +1 -4
  42. data/lib/fog/compute/proxmox/requests/{get_snapshot.rb → get_snapshot_config.rb} +5 -8
  43. data/lib/fog/compute/proxmox/requests/get_task.rb +1 -4
  44. data/lib/fog/compute/proxmox/requests/get_vnc.rb +1 -4
  45. data/lib/fog/compute/proxmox/requests/list_nodes.rb +1 -2
  46. data/lib/fog/compute/proxmox/requests/list_storages.rb +3 -1
  47. data/lib/fog/compute/proxmox/requests/log_task.rb +1 -4
  48. data/lib/fog/compute/proxmox/requests/move_disk.rb +1 -4
  49. data/lib/fog/compute/proxmox/requests/move_volume.rb +1 -4
  50. data/lib/fog/compute/proxmox/requests/next_vmid.rb +5 -3
  51. data/lib/fog/compute/proxmox/requests/resize_container.rb +1 -4
  52. data/lib/fog/compute/proxmox/requests/status_task.rb +1 -4
  53. data/lib/fog/compute/proxmox/requests/update_server.rb +1 -4
  54. data/lib/fog/identity/proxmox.rb +2 -8
  55. data/lib/fog/identity/proxmox/models/domain.rb +25 -21
  56. data/lib/fog/identity/proxmox/models/{ldap.rb → domain_type.rb} +9 -18
  57. data/lib/fog/identity/proxmox/models/domains.rb +6 -76
  58. data/lib/fog/identity/proxmox/models/group.rb +6 -19
  59. data/lib/fog/identity/proxmox/models/groups.rb +6 -12
  60. data/lib/fog/identity/proxmox/models/permission.rb +27 -31
  61. data/lib/fog/identity/proxmox/models/permissions.rb +8 -25
  62. data/lib/fog/identity/proxmox/models/pool.rb +9 -22
  63. data/lib/fog/identity/proxmox/models/pools.rb +7 -13
  64. data/lib/fog/identity/proxmox/models/principal.rb +1 -6
  65. data/lib/fog/identity/proxmox/models/role.rb +7 -20
  66. data/lib/fog/identity/proxmox/models/roles.rb +6 -13
  67. data/lib/fog/identity/proxmox/models/user.rb +7 -21
  68. data/lib/fog/identity/proxmox/models/users.rb +6 -12
  69. data/lib/fog/identity/proxmox/requests/check_permissions.rb +1 -4
  70. data/lib/fog/identity/proxmox/requests/list_roles.rb +0 -1
  71. data/lib/fog/identity/proxmox/requests/read_version.rb +1 -5
  72. data/lib/fog/identity/proxmox/requests/update_group.rb +2 -3
  73. data/lib/fog/identity/proxmox/requests/{add_permission.rb → update_permissions.rb} +4 -4
  74. data/lib/fog/network/proxmox/models/network.rb +12 -18
  75. data/lib/fog/network/proxmox/models/networks.rb +11 -17
  76. data/lib/fog/network/proxmox/models/node.rb +14 -10
  77. data/lib/fog/network/proxmox/models/nodes.rb +5 -11
  78. data/lib/fog/network/proxmox/requests/create_network.rb +1 -4
  79. data/lib/fog/network/proxmox/requests/delete_network.rb +1 -4
  80. data/lib/fog/network/proxmox/requests/get_network.rb +1 -4
  81. data/lib/fog/network/proxmox/requests/get_node.rb +1 -4
  82. data/lib/fog/network/proxmox/requests/power_node.rb +1 -4
  83. data/lib/fog/network/proxmox/requests/update_network.rb +1 -4
  84. data/lib/fog/{compute/proxmox/requests/check_vmid.rb → proxmox/attributes.rb} +9 -17
  85. data/lib/fog/proxmox/core.rb +2 -1
  86. data/lib/fog/proxmox/helpers/cpu_helper.rb +6 -3
  87. data/lib/fog/proxmox/helpers/disk_helper.rb +1 -1
  88. data/lib/fog/proxmox/helpers/nic_helper.rb +37 -22
  89. data/lib/fog/proxmox/version.rb +1 -1
  90. data/lib/fog/storage/proxmox.rb +1 -1
  91. data/spec/compute_spec.rb +64 -45
  92. data/spec/fixtures/proxmox/compute/containers.yml +1684 -4137
  93. data/spec/fixtures/proxmox/compute/identity_ticket.yml +4 -4
  94. data/spec/fixtures/proxmox/compute/nodes.yml +21 -21
  95. data/spec/fixtures/proxmox/compute/servers.yml +3065 -7741
  96. data/spec/fixtures/proxmox/compute/snapshots.yml +279 -827
  97. data/spec/fixtures/proxmox/compute/storages.yml +60 -21
  98. data/spec/fixtures/proxmox/compute/tasks.yml +56 -98
  99. data/spec/fixtures/proxmox/identity/auth.yml +6 -6
  100. data/spec/fixtures/proxmox/identity/domains.yml +252 -84
  101. data/spec/fixtures/proxmox/identity/groups.yml +93 -54
  102. data/spec/fixtures/proxmox/identity/identity_ticket.yml +4 -4
  103. data/spec/fixtures/proxmox/identity/permissions.yml +317 -79
  104. data/spec/fixtures/proxmox/identity/pools.yml +266 -71
  105. data/spec/fixtures/proxmox/identity/read_version.yml +6 -6
  106. data/spec/fixtures/proxmox/identity/roles.yml +96 -57
  107. data/spec/fixtures/proxmox/identity/users.yml +224 -107
  108. data/spec/fixtures/proxmox/network/identity_ticket.yml +4 -4
  109. data/spec/fixtures/proxmox/network/networks.yml +54 -95
  110. data/spec/helpers/nic_helper_spec.rb +4 -4
  111. data/spec/identity_spec.rb +38 -46
  112. data/spec/network_spec.rb +1 -1
  113. metadata +9 -23
  114. data/lib/fog/compute/proxmox/models/container.rb +0 -86
  115. data/lib/fog/compute/proxmox/models/container_config.rb +0 -114
  116. data/lib/fog/compute/proxmox/models/containers.rb +0 -43
  117. data/lib/fog/compute/proxmox/requests/get_node.rb +0 -44
  118. data/lib/fog/compute/proxmox/requests/get_storage.rb +0 -44
  119. data/lib/fog/identity/proxmox/models/activedirectory.rb +0 -57
  120. data/lib/fog/identity/proxmox/models/oath.rb +0 -50
  121. data/lib/fog/identity/proxmox/models/pam.rb +0 -46
  122. data/lib/fog/identity/proxmox/models/pve.rb +0 -46
  123. data/lib/fog/identity/proxmox/models/yubico.rb +0 -51
  124. data/lib/fog/identity/proxmox/requests/remove_permission.rb +0 -42
  125. data/lib/fog/proxmox/models/collection.rb +0 -85
  126. data/lib/fog/proxmox/models/model.rb +0 -58
@@ -1,57 +0,0 @@
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
- # Copyright 2018 Tristan Robert
12
-
13
- # This file is part of Fog::Proxmox.
14
-
15
- # Fog::Proxmox is free software: you can redistribute it and/or modify
16
- # it under the terms of the GNU General Public License as published by
17
- # the Free Software Foundation, either version 3 of the License, or
18
- # (at your option) any later version.
19
-
20
- # Fog::Proxmox is distributed in the hope that it will be useful,
21
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- # GNU General Public License for more details.
24
-
25
- # You should have received a copy of the GNU General Public License
26
- # along with Fog::Proxmox. If not, see <http://www.gnu.org/licenses/>.
27
-
28
- require 'fog/proxmox/models/model'
29
-
30
- module Fog
31
- module Identity
32
- class Proxmox
33
- # class Active Directory authentication
34
- class Activedirectory < Fog::Proxmox::Model
35
- identity :type
36
- attribute :base_dn
37
- attribute :bind_dn
38
- attribute :capath
39
- attribute :cert
40
- attribute :certkey
41
- attribute :comment
42
- attribute :default
43
- attribute :domain
44
- attribute :port
45
- attribute :secure
46
- attribute :server1
47
- attribute :server2
48
- attribute :tfa
49
- attribute :verify
50
- def initialize(attributes)
51
- self.type = 'ad'
52
- super
53
- end
54
- end
55
- end
56
- end
57
- end
@@ -1,50 +0,0 @@
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
- # Copyright 2018 Tristan Robert
11
-
12
- # This file is part of Fog::Proxmox.
13
-
14
- # Fog::Proxmox is free software: you can redistribute it and/or modify
15
- # it under the terms of the GNU General Public License as published by
16
- # the Free Software Foundation, either version 3 of the License, or
17
- # (at your option) any later version.
18
-
19
- # Fog::Proxmox is distributed in the hope that it will be useful,
20
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
21
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
- # GNU General Public License for more details.
23
-
24
- # You should have received a copy of the GNU General Public License
25
- # along with Fog::Proxmox. If not, see <http://www.gnu.org/licenses/>.
26
-
27
- # frozen_string_literal: true
28
-
29
- require 'fog/proxmox/models/model'
30
-
31
- module Fog
32
- module Identity
33
- class Proxmox
34
- # class Oath two factors authentication
35
- class Oath < Fog::Proxmox::Model
36
- identity :type
37
- attribute :step
38
- attribute :digits
39
- def initialize(attributes)
40
- self.type = 'oath'
41
- super
42
- end
43
-
44
- def to_s
45
- "type=#{type},step=#{step},digits=#{digits}"
46
- end
47
- end
48
- end
49
- end
50
- end
@@ -1,46 +0,0 @@
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
- # Copyright 2018 Tristan Robert
12
-
13
- # This file is part of Fog::Proxmox.
14
-
15
- # Fog::Proxmox is free software: you can redistribute it and/or modify
16
- # it under the terms of the GNU General Public License as published by
17
- # the Free Software Foundation, either version 3 of the License, or
18
- # (at your option) any later version.
19
-
20
- # Fog::Proxmox is distributed in the hope that it will be useful,
21
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- # GNU General Public License for more details.
24
-
25
- # You should have received a copy of the GNU General Public License
26
- # along with Fog::Proxmox. If not, see <http://www.gnu.org/licenses/>.
27
-
28
- require 'fog/proxmox/models/model'
29
-
30
- module Fog
31
- module Identity
32
- class Proxmox
33
- # class PAM authentication
34
- class Pam < Fog::Proxmox::Model
35
- identity :type
36
- attribute :comment
37
- attribute :default
38
- attribute :tfa
39
- def initialize(attributes)
40
- self.type = 'pam'
41
- super
42
- end
43
- end
44
- end
45
- end
46
- end
@@ -1,46 +0,0 @@
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
- # Copyright 2018 Tristan Robert
12
-
13
- # This file is part of Fog::Proxmox.
14
-
15
- # Fog::Proxmox is free software: you can redistribute it and/or modify
16
- # it under the terms of the GNU General Public License as published by
17
- # the Free Software Foundation, either version 3 of the License, or
18
- # (at your option) any later version.
19
-
20
- # Fog::Proxmox is distributed in the hope that it will be useful,
21
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- # GNU General Public License for more details.
24
-
25
- # You should have received a copy of the GNU General Public License
26
- # along with Fog::Proxmox. If not, see <http://www.gnu.org/licenses/>.
27
-
28
- require 'fog/proxmox/models/model'
29
-
30
- module Fog
31
- module Identity
32
- class Proxmox
33
- # class PVE authentication
34
- class Pve < Fog::Proxmox::Model
35
- identity :type
36
- attribute :comment
37
- attribute :default
38
- attribute :tfa
39
- def initialize(attributes)
40
- self.type = 'pve'
41
- super
42
- end
43
- end
44
- end
45
- end
46
- end
@@ -1,51 +0,0 @@
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
- # Copyright 2018 Tristan Robert
11
-
12
- # This file is part of Fog::Proxmox.
13
-
14
- # Fog::Proxmox is free software: you can redistribute it and/or modify
15
- # it under the terms of the GNU General Public License as published by
16
- # the Free Software Foundation, either version 3 of the License, or
17
- # (at your option) any later version.
18
-
19
- # Fog::Proxmox is distributed in the hope that it will be useful,
20
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
21
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
- # GNU General Public License for more details.
23
-
24
- # You should have received a copy of the GNU General Public License
25
- # along with Fog::Proxmox. If not, see <http://www.gnu.org/licenses/>.
26
-
27
- # frozen_string_literal: true
28
-
29
- require 'fog/proxmox/models/model'
30
-
31
- module Fog
32
- module Identity
33
- class Proxmox
34
- # class Yubico Two factor authentification
35
- class Yubico < Fog::Proxmox::Model
36
- identity :type
37
- attribute :id
38
- attribute :key
39
- attribute :url
40
- def initialize(attributes)
41
- self.type = 'yubico'
42
- super
43
- end
44
-
45
- def to_s
46
- "type=#{type},id=#{id},key=#{key},url=#{url}"
47
- end
48
- end
49
- end
50
- end
51
- end
@@ -1,42 +0,0 @@
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 Identity
23
- class Proxmox
24
- # class Real remove_permission request
25
- class Real
26
- def remove_permission(permission)
27
- permission.store('delete', 1)
28
- request(
29
- expects: [200],
30
- method: 'PUT',
31
- path: 'access/acl',
32
- body: URI.encode_www_form(permission)
33
- )
34
- end
35
- end
36
-
37
- # class Mock remove_permission request
38
- class Mock
39
- end
40
- end
41
- end
42
- end
@@ -1,85 +0,0 @@
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/core/collection'
22
- require 'fog/proxmox/errors'
23
-
24
- module Fog
25
- module Proxmox
26
- # class Collection proxmox
27
- class Collection < Fog::Collection
28
- attr_accessor :response
29
-
30
- def load_response(response, _index = nil, attributes_ignored = [])
31
- body = JSON.decode(response.body)
32
- objects = body['data']
33
- clear && objects.each { |object| self << new(clear_ignored_attributes(object, attributes_ignored)) }
34
- self.response = response
35
- self
36
- end
37
-
38
- # clear attributes non persistent
39
- def clear_ignored_attributes(object, attributes_ignored = [])
40
- attributes_ignored.each { |attribute| object.delete_if { |key, _value| key == attribute } }
41
- object
42
- end
43
-
44
- def read(response, attribute)
45
- response.body[attribute]
46
- end
47
-
48
- # Proxmox object creation requires identity and return null
49
- def create(attributes = {})
50
- object = new(attributes)
51
- object.create(attributes)
52
- end
53
-
54
- # Returns detailed list of records
55
- def all(_options = {})
56
- raise Fog::Proxmox::Errors::InterfaceNotImplemented, not_implemented('all')
57
- end
58
-
59
- # Returns non detailed list of records, usually just subset of attributes,
60
- # which makes this call more effective.
61
- # Not all Proxmox services support non detailed list, so it delegates to :all by default.
62
- def summary(options = {})
63
- all(options)
64
- end
65
-
66
- # Gets record given record's UUID
67
- def get(_uuid)
68
- raise Fog::Proxmox::Errors::InterfaceNotImplemented, not_implemented('get')
69
- end
70
-
71
- def find_by_id(uuid)
72
- get(uuid)
73
- end
74
-
75
- # Destroys record given record's UUID
76
- def destroy(_uuid)
77
- raise Fog::Proxmox::Errors::InterfaceNotImplemented, not_implemented('destroy')
78
- end
79
-
80
- def not_implemented(method)
81
- "Method #{method} is not implemented"
82
- end
83
- end
84
- end
85
- end
@@ -1,58 +0,0 @@
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/core/model'
22
-
23
- module Fog
24
- module Proxmox
25
- # class Model proxmox
26
- class Model < Fog::Model
27
- def to_s
28
- identity.to_s
29
- end
30
-
31
- def inspect
32
- Fog::Formatador.format(self, include_nested: false)
33
- end
34
-
35
- # Initialize a record
36
- def initialize(attributes)
37
- # Old 'connection' is renamed as service and should be used instead
38
- prepare_service_value(attributes)
39
- super
40
- end
41
-
42
- # Updates a record
43
- def update
44
- # raise Fog::Proxmox::Errors::InterfaceNotImplemented
45
- end
46
-
47
- # Creates a record
48
- def create
49
- # raise Fog::Proxmox::Errors::InterfaceNotImplemented
50
- end
51
-
52
- # Destroys a record
53
- def destroy
54
- # raise Fog::Proxmox::Errors::InterfaceNotImplemented
55
- end
56
- end
57
- end
58
- end