knife-ionoscloud 5.0.0.beta.1 → 5.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (313) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build.yml +20 -0
  3. data/.github/workflows/ci.yml +4 -4
  4. data/.github/workflows/publish.yml +28 -14
  5. data/.rubocop.yml +0 -1
  6. data/README.md +81 -0
  7. data/docs/README.md +52 -18
  8. data/docs/changelog.md +2 -1
  9. data/docs/docs_generator.rb +2 -2
  10. data/docs/subcommands/backupunit_create.md +14 -9
  11. data/docs/subcommands/backupunit_delete.md +13 -8
  12. data/docs/subcommands/backupunit_get.md +35 -0
  13. data/docs/subcommands/backupunit_list.md +13 -8
  14. data/docs/subcommands/backupunit_ssourl.md +15 -10
  15. data/docs/subcommands/backupunit_update.md +41 -0
  16. data/docs/subcommands/composite_server_create.md +14 -9
  17. data/docs/subcommands/contract_list.md +13 -8
  18. data/docs/subcommands/datacenter_create.md +16 -9
  19. data/docs/subcommands/datacenter_delete.md +13 -8
  20. data/docs/subcommands/datacenter_get.md +35 -0
  21. data/docs/subcommands/datacenter_list.md +13 -8
  22. data/docs/subcommands/datacenter_update.md +44 -0
  23. data/docs/subcommands/firewall_create.md +17 -12
  24. data/docs/subcommands/firewall_delete.md +16 -11
  25. data/docs/subcommands/firewall_get.md +47 -0
  26. data/docs/subcommands/firewall_list.md +16 -11
  27. data/docs/subcommands/firewall_update.md +71 -0
  28. data/docs/subcommands/group_create.md +22 -8
  29. data/docs/subcommands/group_delete.md +13 -8
  30. data/docs/subcommands/group_get.md +14 -9
  31. data/docs/subcommands/group_list.md +13 -8
  32. data/docs/subcommands/group_update.md +65 -0
  33. data/docs/subcommands/group_user_add.md +14 -9
  34. data/docs/subcommands/group_user_remove.md +14 -9
  35. data/docs/subcommands/image_list.md +13 -8
  36. data/docs/subcommands/ipblock_create.md +14 -9
  37. data/docs/subcommands/ipblock_delete.md +13 -8
  38. data/docs/subcommands/ipblock_get.md +35 -0
  39. data/docs/subcommands/ipblock_list.md +13 -8
  40. data/docs/subcommands/ipblock_update.md +38 -0
  41. data/docs/subcommands/ipfailover_add.md +16 -11
  42. data/docs/subcommands/ipfailover_remove.md +16 -11
  43. data/docs/subcommands/k8s_create.md +23 -9
  44. data/docs/subcommands/k8s_delete.md +13 -8
  45. data/docs/subcommands/k8s_get.md +35 -0
  46. data/docs/subcommands/k8s_list.md +13 -8
  47. data/docs/subcommands/k8s_update.md +53 -0
  48. data/docs/subcommands/kubeconfig_get.md +14 -9
  49. data/docs/subcommands/label_add.md +14 -9
  50. data/docs/subcommands/label_list.md +13 -8
  51. data/docs/subcommands/label_remove.md +14 -9
  52. data/docs/subcommands/lan_create.md +17 -9
  53. data/docs/subcommands/lan_delete.md +14 -9
  54. data/docs/subcommands/lan_get.md +39 -0
  55. data/docs/subcommands/lan_list.md +14 -9
  56. data/docs/subcommands/lan_update.md +51 -0
  57. data/docs/subcommands/loadbalancer_create.md +15 -10
  58. data/docs/subcommands/loadbalancer_delete.md +14 -9
  59. data/docs/subcommands/loadbalancer_get.md +15 -10
  60. data/docs/subcommands/loadbalancer_list.md +14 -9
  61. data/docs/subcommands/loadbalancer_nic_add.md +15 -10
  62. data/docs/subcommands/loadbalancer_nic_remove.md +15 -10
  63. data/docs/subcommands/loadbalancer_update.md +48 -0
  64. data/docs/subcommands/location_list.md +13 -8
  65. data/docs/subcommands/nic_create.md +18 -14
  66. data/docs/subcommands/nic_delete.md +16 -11
  67. data/docs/subcommands/nic_get.md +43 -0
  68. data/docs/subcommands/nic_list.md +15 -10
  69. data/docs/subcommands/nic_update.md +58 -0
  70. data/docs/subcommands/node_delete.md +15 -10
  71. data/docs/subcommands/node_get.md +43 -0
  72. data/docs/subcommands/node_list.md +15 -10
  73. data/docs/subcommands/node_replace.md +16 -11
  74. data/docs/subcommands/nodepool_create.md +34 -20
  75. data/docs/subcommands/nodepool_delete.md +14 -9
  76. data/docs/subcommands/nodepool_get.md +39 -0
  77. data/docs/subcommands/nodepool_list.md +14 -9
  78. data/docs/subcommands/nodepool_update.md +69 -0
  79. data/docs/subcommands/pcc_create.md +14 -12
  80. data/docs/subcommands/pcc_delete.md +13 -8
  81. data/docs/subcommands/pcc_get.md +35 -0
  82. data/docs/subcommands/pcc_list.md +13 -8
  83. data/docs/subcommands/pcc_update.md +41 -0
  84. data/docs/subcommands/request_get.md +35 -0
  85. data/docs/subcommands/request_list.md +21 -10
  86. data/docs/subcommands/request_status.md +14 -9
  87. data/docs/subcommands/request_wait.md +14 -9
  88. data/docs/subcommands/resource_list.md +13 -8
  89. data/docs/subcommands/s3key_create.md +14 -9
  90. data/docs/subcommands/s3key_delete.md +14 -9
  91. data/docs/subcommands/s3key_get.md +39 -0
  92. data/docs/subcommands/s3key_list.md +14 -9
  93. data/docs/subcommands/server_create.md +15 -10
  94. data/docs/subcommands/server_delete.md +15 -10
  95. data/docs/subcommands/server_get.md +39 -0
  96. data/docs/subcommands/server_list.md +14 -9
  97. data/docs/subcommands/server_reboot.md +14 -9
  98. data/docs/subcommands/server_start.md +15 -10
  99. data/docs/subcommands/server_stop.md +14 -9
  100. data/docs/subcommands/server_update.md +60 -0
  101. data/docs/subcommands/share_create.md +16 -11
  102. data/docs/subcommands/share_delete.md +14 -9
  103. data/docs/subcommands/share_get.md +39 -0
  104. data/docs/subcommands/share_list.md +14 -9
  105. data/docs/subcommands/share_update.md +45 -0
  106. data/docs/subcommands/snapshot_create.md +27 -10
  107. data/docs/subcommands/snapshot_delete.md +13 -8
  108. data/docs/subcommands/snapshot_get.md +35 -0
  109. data/docs/subcommands/snapshot_list.md +13 -8
  110. data/docs/subcommands/snapshot_restore.md +16 -11
  111. data/docs/subcommands/snapshot_update.md +77 -0
  112. data/docs/subcommands/user_create.md +22 -12
  113. data/docs/subcommands/user_delete.md +13 -8
  114. data/docs/subcommands/user_get.md +35 -0
  115. data/docs/subcommands/user_list.md +14 -9
  116. data/docs/subcommands/user_ssourl.md +14 -9
  117. data/docs/subcommands/user_update.md +56 -0
  118. data/docs/subcommands/volume_attach.md +15 -10
  119. data/docs/subcommands/volume_create.md +38 -9
  120. data/docs/subcommands/volume_delete.md +14 -9
  121. data/docs/subcommands/volume_detach.md +15 -10
  122. data/docs/subcommands/volume_get.md +39 -0
  123. data/docs/subcommands/volume_list.md +14 -9
  124. data/docs/subcommands/volume_update.md +66 -0
  125. data/docs/summary.md +33 -0
  126. data/docs/templates/subcommand_doc.mustache +9 -7
  127. data/git-versioning.sh +113 -0
  128. data/lib/chef/knife/ionoscloud_backupunit_create.rb +11 -15
  129. data/lib/chef/knife/ionoscloud_backupunit_delete.rb +2 -4
  130. data/lib/chef/knife/ionoscloud_backupunit_get.rb +33 -0
  131. data/lib/chef/knife/ionoscloud_backupunit_list.rb +1 -0
  132. data/lib/chef/knife/ionoscloud_backupunit_ssourl.rb +2 -1
  133. data/lib/chef/knife/ionoscloud_backupunit_update.rb +62 -0
  134. data/lib/chef/knife/ionoscloud_base.rb +258 -5
  135. data/lib/chef/knife/ionoscloud_composite_server_create.rb +4 -31
  136. data/lib/chef/knife/ionoscloud_contract_list.rb +1 -0
  137. data/lib/chef/knife/ionoscloud_datacenter_create.rb +12 -14
  138. data/lib/chef/knife/ionoscloud_datacenter_delete.rb +2 -7
  139. data/lib/chef/knife/ionoscloud_datacenter_get.rb +33 -0
  140. data/lib/chef/knife/ionoscloud_datacenter_list.rb +4 -1
  141. data/lib/chef/knife/ionoscloud_datacenter_update.rb +67 -0
  142. data/lib/chef/knife/ionoscloud_firewall_create.rb +3 -13
  143. data/lib/chef/knife/ionoscloud_firewall_delete.rb +3 -10
  144. data/lib/chef/knife/ionoscloud_firewall_get.rb +50 -0
  145. data/lib/chef/knife/ionoscloud_firewall_list.rb +1 -0
  146. data/lib/chef/knife/ionoscloud_firewall_update.rb +131 -0
  147. data/lib/chef/knife/ionoscloud_group_create.rb +30 -21
  148. data/lib/chef/knife/ionoscloud_group_delete.rb +2 -11
  149. data/lib/chef/knife/ionoscloud_group_get.rb +2 -11
  150. data/lib/chef/knife/ionoscloud_group_list.rb +14 -7
  151. data/lib/chef/knife/ionoscloud_group_update.rb +114 -0
  152. data/lib/chef/knife/ionoscloud_group_user_add.rb +2 -13
  153. data/lib/chef/knife/ionoscloud_group_user_remove.rb +2 -13
  154. data/lib/chef/knife/ionoscloud_image_list.rb +4 -3
  155. data/lib/chef/knife/ionoscloud_ipblock_create.rb +12 -14
  156. data/lib/chef/knife/ionoscloud_ipblock_delete.rb +3 -4
  157. data/lib/chef/knife/ionoscloud_ipblock_get.rb +33 -0
  158. data/lib/chef/knife/ionoscloud_ipblock_list.rb +4 -1
  159. data/lib/chef/knife/ionoscloud_ipblock_update.rb +57 -0
  160. data/lib/chef/knife/ionoscloud_ipfailover_add.rb +8 -14
  161. data/lib/chef/knife/ionoscloud_ipfailover_remove.rb +2 -8
  162. data/lib/chef/knife/ionoscloud_k8s_create.rb +34 -18
  163. data/lib/chef/knife/ionoscloud_k8s_delete.rb +7 -11
  164. data/lib/chef/knife/ionoscloud_k8s_get.rb +33 -0
  165. data/lib/chef/knife/ionoscloud_k8s_list.rb +1 -0
  166. data/lib/chef/knife/ionoscloud_k8s_update.rb +99 -0
  167. data/lib/chef/knife/ionoscloud_kubeconfig_get.rb +1 -0
  168. data/lib/chef/knife/ionoscloud_label_add.rb +1 -0
  169. data/lib/chef/knife/ionoscloud_label_list.rb +1 -0
  170. data/lib/chef/knife/ionoscloud_label_remove.rb +1 -0
  171. data/lib/chef/knife/ionoscloud_lan_create.rb +11 -12
  172. data/lib/chef/knife/ionoscloud_lan_delete.rb +3 -3
  173. data/lib/chef/knife/ionoscloud_lan_get.rb +38 -0
  174. data/lib/chef/knife/ionoscloud_lan_list.rb +6 -1
  175. data/lib/chef/knife/ionoscloud_lan_update.rb +87 -0
  176. data/lib/chef/knife/ionoscloud_loadbalancer_create.rb +6 -15
  177. data/lib/chef/knife/ionoscloud_loadbalancer_delete.rb +2 -9
  178. data/lib/chef/knife/ionoscloud_loadbalancer_get.rb +4 -13
  179. data/lib/chef/knife/ionoscloud_loadbalancer_list.rb +1 -0
  180. data/lib/chef/knife/ionoscloud_loadbalancer_nic_add.rb +4 -13
  181. data/lib/chef/knife/ionoscloud_loadbalancer_nic_remove.rb +4 -13
  182. data/lib/chef/knife/ionoscloud_loadbalancer_update.rb +73 -0
  183. data/lib/chef/knife/ionoscloud_location_list.rb +1 -0
  184. data/lib/chef/knife/ionoscloud_nic_create.rb +17 -32
  185. data/lib/chef/knife/ionoscloud_nic_delete.rb +4 -8
  186. data/lib/chef/knife/ionoscloud_nic_get.rb +47 -0
  187. data/lib/chef/knife/ionoscloud_nic_list.rb +1 -0
  188. data/lib/chef/knife/ionoscloud_nic_update.rb +93 -0
  189. data/lib/chef/knife/ionoscloud_node_delete.rb +2 -6
  190. data/lib/chef/knife/ionoscloud_node_get.rb +47 -0
  191. data/lib/chef/knife/ionoscloud_node_list.rb +4 -1
  192. data/lib/chef/knife/ionoscloud_node_replace.rb +1 -0
  193. data/lib/chef/knife/ionoscloud_nodepool_create.rb +55 -51
  194. data/lib/chef/knife/ionoscloud_nodepool_delete.rb +2 -7
  195. data/lib/chef/knife/ionoscloud_nodepool_get.rb +41 -0
  196. data/lib/chef/knife/ionoscloud_nodepool_list.rb +1 -0
  197. data/lib/chef/knife/ionoscloud_nodepool_update.rb +124 -0
  198. data/lib/chef/knife/ionoscloud_pcc_create.rb +42 -20
  199. data/lib/chef/knife/ionoscloud_pcc_delete.rb +2 -9
  200. data/lib/chef/knife/ionoscloud_pcc_get.rb +33 -0
  201. data/lib/chef/knife/ionoscloud_pcc_list.rb +1 -0
  202. data/lib/chef/knife/ionoscloud_pcc_update.rb +63 -0
  203. data/lib/chef/knife/ionoscloud_request_get.rb +40 -0
  204. data/lib/chef/knife/ionoscloud_request_list.rb +25 -11
  205. data/lib/chef/knife/ionoscloud_request_status.rb +1 -0
  206. data/lib/chef/knife/ionoscloud_request_wait.rb +1 -0
  207. data/lib/chef/knife/ionoscloud_resource_list.rb +1 -0
  208. data/lib/chef/knife/ionoscloud_s3key_create.rb +2 -5
  209. data/lib/chef/knife/ionoscloud_s3key_delete.rb +2 -4
  210. data/lib/chef/knife/ionoscloud_s3key_get.rb +38 -0
  211. data/lib/chef/knife/ionoscloud_s3key_list.rb +1 -0
  212. data/lib/chef/knife/ionoscloud_server_create.rb +14 -25
  213. data/lib/chef/knife/ionoscloud_server_delete.rb +3 -10
  214. data/lib/chef/knife/ionoscloud_server_get.rb +41 -0
  215. data/lib/chef/knife/ionoscloud_server_list.rb +3 -2
  216. data/lib/chef/knife/ionoscloud_server_reboot.rb +1 -0
  217. data/lib/chef/knife/ionoscloud_server_start.rb +1 -0
  218. data/lib/chef/knife/ionoscloud_server_stop.rb +1 -0
  219. data/lib/chef/knife/ionoscloud_server_update.rb +97 -0
  220. data/lib/chef/knife/ionoscloud_share_create.rb +8 -12
  221. data/lib/chef/knife/ionoscloud_share_delete.rb +3 -4
  222. data/lib/chef/knife/ionoscloud_share_get.rb +38 -0
  223. data/lib/chef/knife/ionoscloud_share_list.rb +1 -0
  224. data/lib/chef/knife/ionoscloud_share_update.rb +70 -0
  225. data/lib/chef/knife/ionoscloud_snapshot_create.rb +26 -9
  226. data/lib/chef/knife/ionoscloud_snapshot_delete.rb +2 -6
  227. data/lib/chef/knife/ionoscloud_snapshot_get.rb +32 -0
  228. data/lib/chef/knife/ionoscloud_snapshot_list.rb +1 -0
  229. data/lib/chef/knife/ionoscloud_snapshot_restore.rb +1 -0
  230. data/lib/chef/knife/ionoscloud_snapshot_update.rb +126 -0
  231. data/lib/chef/knife/ionoscloud_user_create.rb +28 -23
  232. data/lib/chef/knife/ionoscloud_user_delete.rb +2 -7
  233. data/lib/chef/knife/ionoscloud_user_get.rb +32 -0
  234. data/lib/chef/knife/ionoscloud_user_list.rb +2 -1
  235. data/lib/chef/knife/ionoscloud_user_ssourl.rb +1 -0
  236. data/lib/chef/knife/ionoscloud_user_update.rb +92 -0
  237. data/lib/chef/knife/ionoscloud_volume_attach.rb +1 -0
  238. data/lib/chef/knife/ionoscloud_volume_create.rb +62 -38
  239. data/lib/chef/knife/ionoscloud_volume_delete.rb +2 -8
  240. data/lib/chef/knife/ionoscloud_volume_detach.rb +2 -8
  241. data/lib/chef/knife/ionoscloud_volume_get.rb +36 -0
  242. data/lib/chef/knife/ionoscloud_volume_list.rb +2 -1
  243. data/lib/chef/knife/ionoscloud_volume_update.rb +106 -0
  244. data/lib/knife-ionoscloud/version.rb +1 -1
  245. data/sonar-project.properties +12 -0
  246. data/spec/chef/knife/ionoscloud_backupunit_get_spec.rb +65 -0
  247. data/spec/chef/knife/ionoscloud_backupunit_update_spec.rb +78 -0
  248. data/spec/chef/knife/ionoscloud_datacenter_create_spec.rb +10 -0
  249. data/spec/chef/knife/ionoscloud_datacenter_delete_spec.rb +3 -0
  250. data/spec/chef/knife/ionoscloud_datacenter_get_spec.rb +69 -0
  251. data/spec/chef/knife/ionoscloud_datacenter_list_spec.rb +3 -1
  252. data/spec/chef/knife/ionoscloud_datacenter_update_spec.rb +82 -0
  253. data/spec/chef/knife/ionoscloud_firewall_get_spec.rb +76 -0
  254. data/spec/chef/knife/ionoscloud_firewall_update_spec.rb +116 -0
  255. data/spec/chef/knife/ionoscloud_group_create_spec.rb +13 -0
  256. data/spec/chef/knife/ionoscloud_group_delete_spec.rb +3 -0
  257. data/spec/chef/knife/ionoscloud_group_get_spec.rb +3 -0
  258. data/spec/chef/knife/ionoscloud_group_list_spec.rb +17 -8
  259. data/spec/chef/knife/ionoscloud_group_update_spec.rb +109 -0
  260. data/spec/chef/knife/ionoscloud_group_user_add_spec.rb +3 -0
  261. data/spec/chef/knife/ionoscloud_group_user_remove_spec.rb +3 -0
  262. data/spec/chef/knife/ionoscloud_image_list_spec.rb +2 -2
  263. data/spec/chef/knife/ionoscloud_ipblock_delete_spec.rb +2 -0
  264. data/spec/chef/knife/ionoscloud_ipblock_get_spec.rb +66 -0
  265. data/spec/chef/knife/ionoscloud_ipblock_list_spec.rb +3 -1
  266. data/spec/chef/knife/ionoscloud_ipblock_update_spec.rb +79 -0
  267. data/spec/chef/knife/ionoscloud_ipfailover_add_spec.rb +2 -1
  268. data/spec/chef/knife/ionoscloud_ipfailover_remove_spec.rb +4 -3
  269. data/spec/chef/knife/ionoscloud_k8s_create_spec.rb +8 -0
  270. data/spec/chef/knife/ionoscloud_k8s_delete_spec.rb +12 -3
  271. data/spec/chef/knife/ionoscloud_k8s_get_spec.rb +73 -0
  272. data/spec/chef/knife/ionoscloud_k8s_update_spec.rb +115 -0
  273. data/spec/chef/knife/ionoscloud_lan_create_spec.rb +3 -0
  274. data/spec/chef/knife/ionoscloud_lan_delete_spec.rb +2 -0
  275. data/spec/chef/knife/ionoscloud_lan_get_spec.rb +68 -0
  276. data/spec/chef/knife/ionoscloud_lan_list_spec.rb +5 -1
  277. data/spec/chef/knife/ionoscloud_lan_update_spec.rb +91 -0
  278. data/spec/chef/knife/ionoscloud_loadbalancer_update_spec.rb +89 -0
  279. data/spec/chef/knife/ionoscloud_nic_get_spec.rb +70 -0
  280. data/spec/chef/knife/ionoscloud_nic_update_spec.rb +92 -0
  281. data/spec/chef/knife/ionoscloud_node_get_spec.rb +70 -0
  282. data/spec/chef/knife/ionoscloud_node_list_spec.rb +3 -1
  283. data/spec/chef/knife/ionoscloud_nodepool_create_spec.rb +13 -6
  284. data/spec/chef/knife/ionoscloud_nodepool_delete_spec.rb +27 -13
  285. data/spec/chef/knife/ionoscloud_nodepool_get_spec.rb +83 -0
  286. data/spec/chef/knife/ionoscloud_nodepool_update_spec.rb +130 -0
  287. data/spec/chef/knife/ionoscloud_pcc_create_spec.rb +39 -5
  288. data/spec/chef/knife/ionoscloud_pcc_delete_spec.rb +1 -1
  289. data/spec/chef/knife/ionoscloud_pcc_get_spec.rb +71 -0
  290. data/spec/chef/knife/ionoscloud_pcc_update_spec.rb +83 -0
  291. data/spec/chef/knife/ionoscloud_request_get_spec.rb +69 -0
  292. data/spec/chef/knife/ionoscloud_request_list_spec.rb +125 -5
  293. data/spec/chef/knife/ionoscloud_s3key_get_spec.rb +66 -0
  294. data/spec/chef/knife/ionoscloud_server_get_spec.rb +71 -0
  295. data/spec/chef/knife/ionoscloud_server_list_spec.rb +2 -2
  296. data/spec/chef/knife/ionoscloud_server_update_spec.rb +102 -0
  297. data/spec/chef/knife/ionoscloud_share_get_spec.rb +66 -0
  298. data/spec/chef/knife/ionoscloud_share_update_spec.rb +91 -0
  299. data/spec/chef/knife/ionoscloud_snapshot_create_spec.rb +23 -0
  300. data/spec/chef/knife/ionoscloud_snapshot_delete_spec.rb +12 -0
  301. data/spec/chef/knife/ionoscloud_snapshot_get_spec.rb +79 -0
  302. data/spec/chef/knife/ionoscloud_snapshot_update_spec.rb +113 -0
  303. data/spec/chef/knife/ionoscloud_user_create_spec.rb +3 -1
  304. data/spec/chef/knife/ionoscloud_user_delete_spec.rb +4 -2
  305. data/spec/chef/knife/ionoscloud_user_get_spec.rb +70 -0
  306. data/spec/chef/knife/ionoscloud_user_update_spec.rb +110 -0
  307. data/spec/chef/knife/ionoscloud_volume_create_spec.rb +9 -52
  308. data/spec/chef/knife/ionoscloud_volume_delete_spec.rb +9 -0
  309. data/spec/chef/knife/ionoscloud_volume_detach_spec.rb +9 -0
  310. data/spec/chef/knife/ionoscloud_volume_get_spec.rb +80 -0
  311. data/spec/chef/knife/ionoscloud_volume_update_spec.rb +115 -0
  312. data/spec/spec_helper.rb +101 -56
  313. metadata +140 -4
@@ -25,7 +25,8 @@ class Chef
25
25
  option :bus,
26
26
  short: '-b BUS',
27
27
  long: '--bus BUS',
28
- description: 'The bus type of the volume (VIRTIO or IDE)'
28
+ description: 'The bus type of the volume (VIRTIO or IDE)',
29
+ default: 'VIRTIO'
29
30
 
30
31
  option :image,
31
32
  short: '-N ID',
@@ -59,8 +60,45 @@ class Chef
59
60
  option :availability_zone,
60
61
  short: '-Z AVAILABILITY_ZONE',
61
62
  long: '--availability-zone AVAILABILITY_ZONE',
62
- description: 'The volume availability zone of the server',
63
- required: false
63
+ description: 'The volume availability zone of the server'
64
+
65
+ option :backupunit_id,
66
+ short: '-B BACKUPUNIT_ID',
67
+ long: '--backupunit BACKUPUNIT_ID',
68
+ description: 'The uuid of the Backup Unit that user has access to. The property is immutable and is only allowed '\
69
+ 'to be set on a new volume creation. It is mandatory to provide either \'public image\' or \'imageAlias\' in '\
70
+ 'conjunction with this property.'
71
+
72
+ option :user_data,
73
+ short: '-u USER_DATA',
74
+ long: '--user-data USER_DATA',
75
+ description: 'The cloud-init configuration for the volume as base64 encoded string. The property is '\
76
+ 'immutable and is only allowed to be set on a new volume creation. It is mandatory to provide either \'public image\' '\
77
+ 'or \'imageAlias\' that has cloud-init compatibility in conjunction with this property.'
78
+
79
+ option :cpu_hot_plug,
80
+ long: '--cpu-hot-plug CPU_HOT_PLUG',
81
+ description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
82
+
83
+ option :ram_hot_plug,
84
+ long: '--ram-hot-plug RAM_HOT_PLUG',
85
+ description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
86
+
87
+ option :nic_hot_plug,
88
+ long: '--nic-hot-plug NIC_HOT_PLUG',
89
+ description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
90
+
91
+ option :nic_hot_unplug,
92
+ long: '--nic-hot-unplug NIC_HOT_UNPLUG',
93
+ description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
94
+
95
+ option :disc_virtio_hot_plug,
96
+ long: '--disc-virtio-hot_plug DISC_VIRTIO_HOT_PLUG',
97
+ description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
98
+
99
+ option :disc_virtio_hot_unplug,
100
+ long: '--disc-virtio-hot_unplug DISC_VIRTIO_HOT_UNPLUG',
101
+ description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
64
102
 
65
103
  attr_reader :description, :required_options
66
104
 
@@ -74,21 +112,10 @@ class Chef
74
112
 
75
113
  def run
76
114
  $stdout.sync = true
115
+ handle_extra_config
77
116
  validate_required_params(@required_options, config)
78
117
 
79
- if !config[:image] && !config[:image_alias]
80
- ui.error('Either \'--image\' or \'--image-alias\' parameter must be provided')
81
- exit(1)
82
- end
83
-
84
- if !config[:ssh_keys] && !config[:image_password]
85
- ui.error('Either \'--image-password\' or \'--ssh-keys\' parameter must be provided')
86
- exit(1)
87
- end
88
-
89
- if config[:ssh_keys]
90
- config[:ssh_keys] = config[:ssh_keys].split(',')
91
- end
118
+ config[:ssh_keys] = config[:ssh_keys].split(',') if config[:ssh_keys] && config[:ssh_keys].instance_of?(String)
92
119
 
93
120
  print "#{ui.color('Creating volume...', :magenta)}"
94
121
 
@@ -96,37 +123,34 @@ class Chef
96
123
 
97
124
  volume, _, headers = volume_api.datacenters_volumes_post_with_http_info(
98
125
  config[:datacenter_id],
99
- {
100
- properties: {
126
+ Ionoscloud::Volume.new(
127
+ properties: Ionoscloud::VolumeProperties.new(
101
128
  name: config[:name],
102
129
  size: config[:size],
103
- bus: config[:bus] || 'VIRTIO',
130
+ bus: config[:bus],
104
131
  type: config[:type],
105
- licenceType: config[:licence_type],
132
+ licence_type: config[:licence_type],
106
133
  image: config[:image],
107
- imageAlias: config[:image_alias],
108
- sshKeys: config[:sshKeys],
109
- imagePassword: config[:image_password],
110
- availabilityZone: config[:availability_zone],
111
- }.compact
112
- },
134
+ image_alias: config[:image_alias],
135
+ ssh_keys: config[:ssh_keys],
136
+ image_password: config[:image_password],
137
+ availability_zone: config[:availability_zone],
138
+ backupunit_id: config[:backupunit_id],
139
+ user_data: config[:user_data],
140
+ cpu_hot_plug: (config.key?(:cpu_hot_plug) ? config[:cpu_hot_plug].to_s.downcase == 'true' : nil),
141
+ ram_hot_plug: (config.key?(:ram_hot_plug) ? config[:ram_hot_plug].to_s.downcase == 'true' : nil),
142
+ nic_hot_plug: (config.key?(:nic_hot_plug) ? config[:nic_hot_plug].to_s.downcase == 'true' : nil),
143
+ nic_hot_unplug: (config.key?(:nic_hot_unplug) ? config[:nic_hot_unplug].to_s.downcase == 'true' : nil),
144
+ disc_virtio_hot_plug: (config.key?(:disc_virtio_hot_plug) ? config[:disc_virtio_hot_plug].to_s.downcase == 'true' : nil),
145
+ disc_virtio_hot_unplug: (config.key?(:disc_virtio_hot_unplug) ? config[:disc_virtio_hot_unplug].to_s.downcase == 'true' : nil),
146
+ ),
147
+ ),
113
148
  )
114
149
 
115
150
  dot = ui.color('.', :magenta)
116
151
  api_client.wait_for(300) { print dot; is_done? get_request_id headers }
117
152
 
118
- volume = volume_api.datacenters_volumes_find_by_id(config[:datacenter_id], volume.id)
119
-
120
- puts "\n"
121
- puts "#{ui.color('ID', :cyan)}: #{volume.id}"
122
- puts "#{ui.color('Name', :cyan)}: #{volume.properties.name}"
123
- puts "#{ui.color('Size', :cyan)}: #{volume.properties.size}"
124
- puts "#{ui.color('Bus', :cyan)}: #{volume.properties.bus}"
125
- puts "#{ui.color('Image', :cyan)}: #{volume.properties.image}"
126
- puts "#{ui.color('Type', :cyan)}: #{volume.properties.type}"
127
- puts "#{ui.color('Licence Type', :cyan)}: #{volume.properties.licence_type}"
128
- puts "#{ui.color('Zone', :cyan)}: #{volume.properties.availability_zone}"
129
- puts 'done'
153
+ print_volume(volume_api.datacenters_volumes_find_by_id(config[:datacenter_id], volume.id))
130
154
  end
131
155
  end
132
156
  end
@@ -24,6 +24,7 @@ class Chef
24
24
 
25
25
  def run
26
26
  $stdout.sync = true
27
+ handle_extra_config
27
28
  validate_required_params(@required_options, config)
28
29
 
29
30
  volume_api = Ionoscloud::VolumeApi.new(api_client)
@@ -40,14 +41,7 @@ class Chef
40
41
  next
41
42
  end
42
43
 
43
- msg_pair('ID', volume.id)
44
- msg_pair('Name', volume.properties.name)
45
- msg_pair('Size', volume.properties.size)
46
- msg_pair('Bus', volume.properties.bus)
47
- msg_pair('Image', volume.properties.image)
48
- msg_pair('Type', volume.properties.type)
49
- msg_pair('Licence Type', volume.properties.licence_type)
50
- msg_pair('Zone', volume.properties.availability_zone)
44
+ print_volume(volume)
51
45
 
52
46
  begin
53
47
  confirm('Do you really want to delete this volume')
@@ -31,6 +31,7 @@ class Chef
31
31
 
32
32
  def run
33
33
  $stdout.sync = true
34
+ handle_extra_config
34
35
  validate_required_params(@required_options, config)
35
36
 
36
37
  server_api = Ionoscloud::ServerApi.new(api_client)
@@ -48,14 +49,7 @@ class Chef
48
49
  next
49
50
  end
50
51
 
51
- msg_pair('ID', volume.id)
52
- msg_pair('Name', volume.properties.name)
53
- msg_pair('Size', volume.properties.size)
54
- msg_pair('Bus', volume.properties.bus)
55
- msg_pair('Image', volume.properties.image)
56
- msg_pair('Type', volume.properties.type)
57
- msg_pair('Licence Type', volume.properties.licence_type)
58
- msg_pair('Zone', volume.properties.availability_zone)
52
+ print_volume(volume)
59
53
 
60
54
  begin
61
55
  confirm('Do you really want to detach this volume')
@@ -0,0 +1,36 @@
1
+ require_relative 'ionoscloud_base'
2
+
3
+ class Chef
4
+ class Knife
5
+ class IonoscloudVolumeGet < Knife
6
+ include Knife::IonoscloudBase
7
+
8
+ banner 'knife ionoscloud volume get (options)'
9
+
10
+ option :datacenter_id,
11
+ short: '-D DATACENTER_ID',
12
+ long: '--datacenter-id DATACENTER_ID',
13
+ description: 'ID of the data center'
14
+
15
+ option :volume_id,
16
+ long: '--volume VOLUME_ID',
17
+ description: 'ID of the volume.'
18
+
19
+ attr_reader :description, :required_options
20
+
21
+ def initialize(args = [])
22
+ super(args)
23
+ @description =
24
+ 'Retrieves the attributes of a given Volume.'
25
+ @required_options = [:datacenter_id, :volume_id, :ionoscloud_username, :ionoscloud_password]
26
+ end
27
+
28
+ def run
29
+ $stdout.sync = true
30
+ handle_extra_config
31
+ validate_required_params(@required_options, config)
32
+ print_volume(Ionoscloud::VolumeApi.new(api_client).datacenters_volumes_find_by_id(config[:datacenter_id], config[:volume_id]))
33
+ end
34
+ end
35
+ end
36
+ end
@@ -29,6 +29,7 @@ class Chef
29
29
 
30
30
  def run
31
31
  $stdout.sync = true
32
+ handle_extra_config
32
33
  validate_required_params(@required_options, config)
33
34
 
34
35
  volume_list = [
@@ -39,7 +40,7 @@ class Chef
39
40
  ui.color('Image', :bold),
40
41
  ui.color('Type', :bold),
41
42
  ui.color('Zone', :bold),
42
- ui.color('Device Number', :bold)
43
+ ui.color('Device Number', :bold),
43
44
  ]
44
45
 
45
46
  opts = { depth: 1 }
@@ -0,0 +1,106 @@
1
+ require_relative 'ionoscloud_base'
2
+
3
+ class Chef
4
+ class Knife
5
+ class IonoscloudVolumeUpdate < Knife
6
+ include Knife::IonoscloudBase
7
+
8
+ banner 'knife ionoscloud volume update (options)'
9
+
10
+ option :datacenter_id,
11
+ short: '-D DATACENTER_ID',
12
+ long: '--datacenter-id DATACENTER_ID',
13
+ description: 'Name of the data center'
14
+
15
+ option :volume_id,
16
+ long: '--volume VOLUME_ID',
17
+ description: 'ID of the Volume.'
18
+
19
+ option :name,
20
+ short: '-n NAME',
21
+ long: '--name NAME',
22
+ description: 'Name of the volume'
23
+
24
+ option :size,
25
+ short: '-S SIZE',
26
+ long: '--size SIZE',
27
+ description: 'The size of the volume in GB'
28
+
29
+ option :bus,
30
+ short: '-b BUS',
31
+ long: '--bus BUS',
32
+ description: 'The bus type of the volume (VIRTIO or IDE)'
33
+
34
+ option :cpu_hot_plug,
35
+ long: '--cpu-hot-plug CPU_HOT_PLUG',
36
+ description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
37
+
38
+ option :ram_hot_plug,
39
+ long: '--ram-hot-plug RAM_HOT_PLUG',
40
+ description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
41
+
42
+ option :nic_hot_plug,
43
+ long: '--nic-hot-plug NIC_HOT_PLUG',
44
+ description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
45
+
46
+ option :nic_hot_unplug,
47
+ long: '--nic-hot-unplug NIC_HOT_UNPLUG',
48
+ description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
49
+
50
+ option :disc_virtio_hot_plug,
51
+ long: '--disc-virtio-hot_plug DISC_VIRTIO_HOT_PLUG',
52
+ description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
53
+
54
+ option :disc_virtio_hot_unplug,
55
+ long: '--disc-virtio-hot_unplug DISC_VIRTIO_HOT_UNPLUG',
56
+ description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
57
+
58
+ attr_reader :description, :required_options
59
+
60
+ def initialize(args = [])
61
+ super(args)
62
+ @description =
63
+ 'Updates information about a Ionoscloud Volume.'
64
+ @required_options = [:datacenter_id, :volume_id, :ionoscloud_username, :ionoscloud_password]
65
+ @updatable_fields = [
66
+ :name, :size, :bus, :cpu_hot_plug, :ram_hot_plug, :nic_hot_plug, :nic_hot_unplug, :disc_virtio_hot_plug, :disc_virtio_hot_unplug,
67
+ ]
68
+ end
69
+
70
+ def run
71
+ $stdout.sync = true
72
+ handle_extra_config
73
+ validate_required_params(@required_options, config)
74
+
75
+ volume = Ionoscloud::VolumeApi.new(api_client)
76
+
77
+ if @updatable_fields.map { |el| config[el] }.any?
78
+ print "#{ui.color('Updating Volume...', :magenta)}"
79
+
80
+ _, _, headers = volume.datacenters_volumes_patch_with_http_info(
81
+ config[:datacenter_id],
82
+ config[:volume_id],
83
+ Ionoscloud::VolumeProperties.new(
84
+ name: config[:name],
85
+ size: config[:size],
86
+ bus: config[:bus],
87
+ cpu_hot_plug: (config.key?(:cpu_hot_plug) ? config[:cpu_hot_plug].to_s.downcase == 'true' : nil),
88
+ ram_hot_plug: (config.key?(:ram_hot_plug) ? config[:ram_hot_plug].to_s.downcase == 'true' : nil),
89
+ nic_hot_plug: (config.key?(:nic_hot_plug) ? config[:nic_hot_plug].to_s.downcase == 'true' : nil),
90
+ nic_hot_unplug: (config.key?(:nic_hot_unplug) ? config[:nic_hot_unplug].to_s.downcase == 'true' : nil),
91
+ disc_virtio_hot_plug: (config.key?(:disc_virtio_hot_plug) ? config[:disc_virtio_hot_plug].to_s.downcase == 'true' : nil),
92
+ disc_virtio_hot_unplug: (config.key?(:disc_virtio_hot_unplug) ? config[:disc_virtio_hot_unplug].to_s.downcase == 'true' : nil),
93
+ ),
94
+ )
95
+
96
+ dot = ui.color('.', :magenta)
97
+ api_client.wait_for { print dot; is_done? get_request_id headers }
98
+ else
99
+ ui.warn("Nothing to update, please set one of the attributes #{@updatable_fields}.")
100
+ end
101
+
102
+ print_volume(volume.datacenters_volumes_find_by_id(config[:datacenter_id], config[:volume_id]))
103
+ end
104
+ end
105
+ end
106
+ end
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Ionoscloud
3
- VERSION = '5.0.0.beta.1'
3
+ VERSION = '5.1.2'
4
4
  MAJOR, MINOR, TINY = VERSION.split('.')
5
5
  end
6
6
  end
@@ -0,0 +1,12 @@
1
+ sonar.projectKey=knife-plugin
2
+ sonar.organization=ionos-cloud
3
+
4
+ # This is the name and version displayed in the SonarCloud UI.
5
+ #sonar.projectName=knife-plugin
6
+ #sonar.projectVersion=1.0
7
+
8
+ # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
9
+ #sonar.sources=.
10
+
11
+ # Encoding of the source code. Default is default system encoding
12
+ #sonar.sourceEncoding=UTF-8
@@ -0,0 +1,65 @@
1
+ require 'spec_helper'
2
+ require 'ionoscloud_backupunit_get'
3
+
4
+ Chef::Knife::IonoscloudBackupunitGet.load_deps
5
+
6
+ describe Chef::Knife::IonoscloudBackupunitGet do
7
+ before :each do
8
+ subject { Chef::Knife::IonoscloudBackupunitGet.new }
9
+
10
+ allow(subject).to receive(:puts)
11
+ allow(subject).to receive(:print)
12
+ end
13
+
14
+ describe '#run' do
15
+ it 'should call BackupUnitApi.backupunits_find_by_id' do
16
+ backupunit = backupunit_mock
17
+ subject_config = {
18
+ ionoscloud_username: 'email',
19
+ ionoscloud_password: 'password',
20
+ backupunit_id: backupunit.id,
21
+ yes: true,
22
+ }
23
+
24
+ subject_config.each { |key, value| subject.config[key] = value }
25
+
26
+ expect(subject).to receive(:puts).with("ID: #{backupunit.id}")
27
+ expect(subject).to receive(:puts).with("Name: #{backupunit.properties.name}")
28
+ expect(subject).to receive(:puts).with("Email: #{backupunit.properties.email}")
29
+
30
+ expect(subject.api_client).not_to receive(:wait_for)
31
+ mock_call_api(
32
+ subject,
33
+ [
34
+ {
35
+ method: 'GET',
36
+ path: "/backupunits/#{backupunit.id}",
37
+ operation: :'BackupUnitApi.backupunits_find_by_id',
38
+ return_type: 'BackupUnit',
39
+ result: backupunit,
40
+ },
41
+ ],
42
+ )
43
+
44
+ expect { subject.run }.not_to raise_error(Exception)
45
+ end
46
+
47
+ it 'should not make any call if any required option is missing' do
48
+ required_options = subject.instance_variable_get(:@required_options)
49
+
50
+ arrays_without_one_element(required_options).each do |test_case|
51
+
52
+ test_case[:array].each { |value| subject.config[value] = 'test' }
53
+
54
+ expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
55
+ expect(subject.api_client).not_to receive(:call_api)
56
+
57
+ expect { subject.run }.to raise_error(SystemExit) do |error|
58
+ expect(error.status).to eq(1)
59
+ end
60
+
61
+ required_options.each { |value| subject.config[value] = nil }
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,78 @@
1
+ require 'spec_helper'
2
+ require 'ionoscloud_backupunit_update'
3
+
4
+ Chef::Knife::IonoscloudBackupunitUpdate.load_deps
5
+
6
+ describe Chef::Knife::IonoscloudBackupunitUpdate do
7
+ before :each do
8
+ subject { Chef::Knife::IonoscloudBackupunitUpdate.new }
9
+
10
+ allow(subject).to receive(:puts)
11
+ allow(subject).to receive(:print)
12
+ end
13
+
14
+ describe '#run' do
15
+ it 'should call BackupUnitApi.backupunits_patch' do
16
+ backupunit = backupunit_mock
17
+ subject_config = {
18
+ ionoscloud_username: 'email',
19
+ ionoscloud_password: 'password',
20
+ backupunit_id: backupunit.id,
21
+ email: 'edited' + backupunit.properties.email,
22
+ password: 'password_edited',
23
+ yes: true,
24
+ }
25
+
26
+ subject_config.each { |key, value| subject.config[key] = value }
27
+
28
+
29
+ expect(subject).to receive(:puts).with("ID: #{backupunit.id}")
30
+ expect(subject).to receive(:puts).with("Name: #{backupunit.properties.name}")
31
+ expect(subject).to receive(:puts).with("Email: #{subject_config[:email]}")
32
+
33
+ backupunit.properties.email = subject_config[:email]
34
+
35
+ mock_wait_for(subject)
36
+ mock_call_api(
37
+ subject,
38
+ [
39
+ {
40
+ method: 'PATCH',
41
+ path: "/backupunits/#{backupunit.id}",
42
+ operation: :'BackupUnitApi.backupunits_patch',
43
+ return_type: 'BackupUnit',
44
+ body: { email: subject_config[:email], password: subject_config[:password] },
45
+ result: backupunit,
46
+ },
47
+ {
48
+ method: 'GET',
49
+ path: "/backupunits/#{backupunit.id}",
50
+ operation: :'BackupUnitApi.backupunits_find_by_id',
51
+ return_type: 'BackupUnit',
52
+ result: backupunit,
53
+ },
54
+ ],
55
+ )
56
+
57
+ expect { subject.run }.not_to raise_error(Exception)
58
+ end
59
+
60
+ it 'should not make any call if any required option is missing' do
61
+ required_options = subject.instance_variable_get(:@required_options)
62
+
63
+ arrays_without_one_element(required_options).each do |test_case|
64
+
65
+ test_case[:array].each { |value| subject.config[value] = 'test' }
66
+
67
+ expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
68
+ expect(subject.api_client).not_to receive(:call_api)
69
+
70
+ expect { subject.run }.to raise_error(SystemExit) do |error|
71
+ expect(error.status).to eq(1)
72
+ end
73
+
74
+ required_options.each { |value| subject.config[value] = nil }
75
+ end
76
+ end
77
+ end
78
+ end
@@ -29,6 +29,9 @@ describe Chef::Knife::IonoscloudDatacenterCreate do
29
29
  expect(subject).to receive(:puts).with("Name: #{datacenter.properties.name}")
30
30
  expect(subject).to receive(:puts).with("Description: #{datacenter.properties.description}")
31
31
  expect(subject).to receive(:puts).with("Location: #{datacenter.properties.location}")
32
+ expect(subject).to receive(:puts).with("Version: #{datacenter.properties.version}")
33
+ expect(subject).to receive(:puts).with("Features: #{datacenter.properties.features}")
34
+ expect(subject).to receive(:puts).with("Sec Auth Protection: #{datacenter.properties.sec_auth_protection}")
32
35
 
33
36
  expected_body = datacenter.properties.to_hash
34
37
  expected_body.delete(:version)
@@ -45,6 +48,13 @@ describe Chef::Knife::IonoscloudDatacenterCreate do
45
48
  body: { properties: expected_body },
46
49
  result: datacenter,
47
50
  },
51
+ {
52
+ method: 'GET',
53
+ path: "/datacenters/#{datacenter.id}",
54
+ operation: :'DataCenterApi.datacenters_find_by_id',
55
+ return_type: 'Datacenter',
56
+ result: datacenter,
57
+ },
48
58
  ],
49
59
  )
50
60
 
@@ -27,6 +27,9 @@ describe Chef::Knife::IonoscloudDatacenterDelete do
27
27
  expect(subject).to receive(:puts).with("Name: #{datacenter.properties.name}")
28
28
  expect(subject).to receive(:puts).with("Description: #{datacenter.properties.description}")
29
29
  expect(subject).to receive(:puts).with("Location: #{datacenter.properties.location}")
30
+ expect(subject).to receive(:puts).with("Version: #{datacenter.properties.version}")
31
+ expect(subject).to receive(:puts).with("Features: #{datacenter.properties.features}")
32
+ expect(subject).to receive(:puts).with("Sec Auth Protection: #{datacenter.properties.sec_auth_protection}")
30
33
  expect(subject.ui).to receive(:warn).with("Deleted Data center #{datacenter.id}. Request ID: ")
31
34
 
32
35
  expect(subject.api_client).not_to receive(:wait_for)
@@ -0,0 +1,69 @@
1
+ require 'spec_helper'
2
+ require 'ionoscloud_datacenter_get'
3
+
4
+ Chef::Knife::IonoscloudDatacenterGet.load_deps
5
+
6
+ describe Chef::Knife::IonoscloudDatacenterGet do
7
+ before :each do
8
+ subject { Chef::Knife::IonoscloudDatacenterGet.new }
9
+
10
+ allow(subject).to receive(:puts)
11
+ allow(subject).to receive(:print)
12
+ end
13
+
14
+ describe '#run' do
15
+ it 'should call DataCenterApi.datacenters_find_by_id' do
16
+ datacenter = datacenter_mock
17
+ subject_config = {
18
+ ionoscloud_username: 'email',
19
+ ionoscloud_password: 'password',
20
+ datacenter_id: datacenter.id,
21
+ yes: true,
22
+ }
23
+
24
+ subject_config.each { |key, value| subject.config[key] = value }
25
+
26
+ expect(subject).to receive(:puts).with("ID: #{datacenter.id}")
27
+ expect(subject).to receive(:puts).with("Name: #{datacenter.properties.name}")
28
+ expect(subject).to receive(:puts).with("Description: #{datacenter.properties.description}")
29
+ expect(subject).to receive(:puts).with("Location: #{datacenter.properties.location}")
30
+ expect(subject).to receive(:puts).with("Version: #{datacenter.properties.version}")
31
+ expect(subject).to receive(:puts).with("Features: #{datacenter.properties.features}")
32
+ expect(subject).to receive(:puts).with("Sec Auth Protection: #{datacenter.properties.sec_auth_protection}")
33
+
34
+ expect(subject.api_client).not_to receive(:wait_for)
35
+ mock_call_api(
36
+ subject,
37
+ [
38
+ {
39
+ method: 'GET',
40
+ path: "/datacenters/#{datacenter.id}",
41
+ operation: :'DataCenterApi.datacenters_find_by_id',
42
+ return_type: 'Datacenter',
43
+ result: datacenter,
44
+ },
45
+ ],
46
+ )
47
+
48
+ expect { subject.run }.not_to raise_error(Exception)
49
+ end
50
+
51
+ it 'should not make any call if any required option is missing' do
52
+ required_options = subject.instance_variable_get(:@required_options)
53
+
54
+ arrays_without_one_element(required_options).each do |test_case|
55
+
56
+ test_case[:array].each { |value| subject.config[value] = 'test' }
57
+
58
+ expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
59
+ expect(subject.api_client).not_to receive(:call_api)
60
+
61
+ expect { subject.run }.to raise_error(SystemExit) do |error|
62
+ expect(error.status).to eq(1)
63
+ end
64
+
65
+ required_options.each { |value| subject.config[value] = nil }
66
+ end
67
+ end
68
+ end
69
+ end
@@ -27,6 +27,7 @@ describe Chef::Knife::IonoscloudDatacenterList do
27
27
  subject.ui.color('Description', :bold),
28
28
  subject.ui.color('Location', :bold),
29
29
  subject.ui.color('Version', :bold),
30
+ subject.ui.color('Sec Auth Protection', :bold),
30
31
  ]
31
32
 
32
33
  datacenters.items.each do |datacenter|
@@ -35,9 +36,10 @@ describe Chef::Knife::IonoscloudDatacenterList do
35
36
  datacenter_list << datacenter.properties.description
36
37
  datacenter_list << datacenter.properties.location
37
38
  datacenter_list << datacenter.properties.version.to_s
39
+ datacenter_list << datacenter.properties.sec_auth_protection.to_s
38
40
  end
39
41
 
40
- expect(subject.ui).to receive(:list).with(datacenter_list, :uneven_columns_across, 5)
42
+ expect(subject.ui).to receive(:list).with(datacenter_list, :uneven_columns_across, 6)
41
43
 
42
44
  mock_call_api(
43
45
  subject,