knife-ionoscloud 5.1.1 → 6.0.0.beta.2

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.
Files changed (326) hide show
  1. checksums.yaml +4 -4
  2. data/docs/README.md +1 -1
  3. data/docs/subcommands/composite_server_create.md +9 -3
  4. data/docs/subcommands/cube_server_create.md +91 -0
  5. data/docs/subcommands/firewall_create.md +5 -2
  6. data/docs/subcommands/flowlog_create.md +63 -0
  7. data/docs/subcommands/flowlog_delete.md +51 -0
  8. data/docs/subcommands/flowlog_list.md +51 -0
  9. data/docs/subcommands/group_create.md +10 -1
  10. data/docs/subcommands/natgateway_create.md +41 -0
  11. data/docs/subcommands/natgateway_delete.md +35 -0
  12. data/docs/subcommands/natgateway_lan_add.md +46 -0
  13. data/docs/subcommands/natgateway_lan_remove.md +39 -0
  14. data/docs/subcommands/natgateway_list.md +35 -0
  15. data/docs/subcommands/natgateway_rule_add.md +66 -0
  16. data/docs/subcommands/natgateway_rule_list.md +38 -0
  17. data/docs/subcommands/natgateway_rule_remove.md +39 -0
  18. data/docs/subcommands/networkloadbalancer_create.md +54 -0
  19. data/docs/subcommands/networkloadbalancer_delete.md +35 -0
  20. data/docs/subcommands/networkloadbalancer_list.md +35 -0
  21. data/docs/subcommands/networkloadbalancer_rule_add.md +72 -0
  22. data/docs/subcommands/networkloadbalancer_rule_list.md +39 -0
  23. data/docs/subcommands/networkloadbalancer_rule_remove.md +39 -0
  24. data/docs/subcommands/networkloadbalancer_rule_target_add.md +64 -0
  25. data/docs/subcommands/networkloadbalancer_rule_target_list.md +43 -0
  26. data/docs/subcommands/networkloadbalancer_rule_target_remove.md +51 -0
  27. data/docs/subcommands/nic_create.md +3 -3
  28. data/docs/subcommands/nodepool_lan_add.md +49 -0
  29. data/docs/subcommands/nodepool_lan_remove.md +39 -0
  30. data/docs/subcommands/server_console.md +39 -0
  31. data/docs/subcommands/server_list.md +4 -1
  32. data/docs/subcommands/server_resume.md +35 -0
  33. data/docs/subcommands/server_suspend.md +35 -0
  34. data/docs/subcommands/server_token.md +39 -0
  35. data/docs/subcommands/server_upgrade.md +39 -0
  36. data/docs/subcommands/template_list.md +31 -0
  37. data/docs/subcommands/volume_create.md +2 -5
  38. data/docs/summary.md +29 -0
  39. data/knife-ionoscloud.gemspec +1 -1
  40. data/lib/chef/knife/ionoscloud_backupunit_create.rb +12 -16
  41. data/lib/chef/knife/ionoscloud_backupunit_delete.rb +2 -5
  42. data/lib/chef/knife/ionoscloud_backupunit_get.rb +33 -0
  43. data/lib/chef/knife/ionoscloud_backupunit_list.rb +1 -1
  44. data/lib/chef/knife/ionoscloud_backupunit_ssourl.rb +1 -1
  45. data/lib/chef/knife/ionoscloud_backupunit_update.rb +62 -0
  46. data/lib/chef/knife/ionoscloud_base.rb +309 -1
  47. data/lib/chef/knife/ionoscloud_composite_server_create.rb +23 -5
  48. data/lib/chef/knife/ionoscloud_contract_list.rb +32 -23
  49. data/lib/chef/knife/ionoscloud_cube_server_create.rb +212 -0
  50. data/lib/chef/knife/ionoscloud_datacenter_create.rb +11 -14
  51. data/lib/chef/knife/ionoscloud_datacenter_delete.rb +2 -7
  52. data/lib/chef/knife/ionoscloud_datacenter_get.rb +33 -0
  53. data/lib/chef/knife/ionoscloud_datacenter_list.rb +4 -2
  54. data/lib/chef/knife/ionoscloud_datacenter_update.rb +67 -0
  55. data/lib/chef/knife/ionoscloud_firewall_create.rb +16 -21
  56. data/lib/chef/knife/ionoscloud_firewall_delete.rb +5 -13
  57. data/lib/chef/knife/ionoscloud_firewall_get.rb +52 -0
  58. data/lib/chef/knife/ionoscloud_firewall_list.rb +5 -3
  59. data/lib/chef/knife/ionoscloud_firewall_update.rb +133 -0
  60. data/lib/chef/knife/ionoscloud_flowlog_create.rb +116 -0
  61. data/lib/chef/knife/ionoscloud_flowlog_delete.rb +103 -0
  62. data/lib/chef/knife/ionoscloud_flowlog_get.rb +84 -0
  63. data/lib/chef/knife/ionoscloud_flowlog_list.rb +101 -0
  64. data/lib/chef/knife/ionoscloud_flowlog_update.rb +127 -0
  65. data/lib/chef/knife/ionoscloud_group_create.rb +33 -27
  66. data/lib/chef/knife/ionoscloud_group_delete.rb +1 -11
  67. data/lib/chef/knife/ionoscloud_group_get.rb +1 -13
  68. data/lib/chef/knife/ionoscloud_group_list.rb +19 -7
  69. data/lib/chef/knife/ionoscloud_group_update.rb +131 -0
  70. data/lib/chef/knife/ionoscloud_group_user_add.rb +1 -18
  71. data/lib/chef/knife/ionoscloud_group_user_remove.rb +1 -18
  72. data/lib/chef/knife/ionoscloud_image_list.rb +1 -1
  73. data/lib/chef/knife/ionoscloud_ipblock_create.rb +10 -13
  74. data/lib/chef/knife/ionoscloud_ipblock_delete.rb +1 -4
  75. data/lib/chef/knife/ionoscloud_ipblock_get.rb +33 -0
  76. data/lib/chef/knife/ionoscloud_ipblock_update.rb +57 -0
  77. data/lib/chef/knife/ionoscloud_ipfailover_add.rb +1 -1
  78. data/lib/chef/knife/ionoscloud_ipfailover_remove.rb +1 -1
  79. data/lib/chef/knife/ionoscloud_k8s_create.rb +27 -35
  80. data/lib/chef/knife/ionoscloud_k8s_delete.rb +1 -9
  81. data/lib/chef/knife/ionoscloud_k8s_get.rb +33 -0
  82. data/lib/chef/knife/ionoscloud_k8s_update.rb +99 -0
  83. data/lib/chef/knife/ionoscloud_label_add.rb +1 -1
  84. data/lib/chef/knife/ionoscloud_label_list.rb +1 -1
  85. data/lib/chef/knife/ionoscloud_label_remove.rb +1 -1
  86. data/lib/chef/knife/ionoscloud_lan_create.rb +6 -14
  87. data/lib/chef/knife/ionoscloud_lan_delete.rb +3 -4
  88. data/lib/chef/knife/ionoscloud_lan_get.rb +38 -0
  89. data/lib/chef/knife/ionoscloud_lan_list.rb +2 -1
  90. data/lib/chef/knife/ionoscloud_lan_update.rb +76 -0
  91. data/lib/chef/knife/ionoscloud_loadbalancer_create.rb +4 -14
  92. data/lib/chef/knife/ionoscloud_loadbalancer_delete.rb +2 -9
  93. data/lib/chef/knife/ionoscloud_loadbalancer_get.rb +3 -13
  94. data/lib/chef/knife/ionoscloud_loadbalancer_list.rb +1 -1
  95. data/lib/chef/knife/ionoscloud_loadbalancer_nic_add.rb +3 -15
  96. data/lib/chef/knife/ionoscloud_loadbalancer_nic_remove.rb +3 -16
  97. data/lib/chef/knife/ionoscloud_loadbalancer_update.rb +73 -0
  98. data/lib/chef/knife/ionoscloud_location_list.rb +5 -3
  99. data/lib/chef/knife/ionoscloud_natgateway_create.rb +60 -0
  100. data/lib/chef/knife/ionoscloud_natgateway_delete.rb +54 -0
  101. data/lib/chef/knife/ionoscloud_natgateway_get.rb +42 -0
  102. data/lib/chef/knife/ionoscloud_natgateway_lan_add.rb +74 -0
  103. data/lib/chef/knife/ionoscloud_natgateway_lan_remove.rb +52 -0
  104. data/lib/chef/knife/ionoscloud_natgateway_list.rb +51 -0
  105. data/lib/chef/knife/ionoscloud_natgateway_rule_add.rb +107 -0
  106. data/lib/chef/knife/ionoscloud_natgateway_rule_list.rb +65 -0
  107. data/lib/chef/knife/ionoscloud_natgateway_rule_remove.rb +55 -0
  108. data/lib/chef/knife/ionoscloud_natgateway_rule_update.rb +116 -0
  109. data/lib/chef/knife/ionoscloud_natgateway_update.rb +84 -0
  110. data/lib/chef/knife/ionoscloud_networkloadbalancer_create.rb +89 -0
  111. data/lib/chef/knife/ionoscloud_networkloadbalancer_delete.rb +62 -0
  112. data/lib/chef/knife/ionoscloud_networkloadbalancer_get.rb +42 -0
  113. data/lib/chef/knife/ionoscloud_networkloadbalancer_list.rb +57 -0
  114. data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_add.rb +141 -0
  115. data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_list.rb +65 -0
  116. data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_remove.rb +68 -0
  117. data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_target_add.rb +124 -0
  118. data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_target_list.rb +70 -0
  119. data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_target_remove.rb +88 -0
  120. data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_update.rb +148 -0
  121. data/lib/chef/knife/ionoscloud_networkloadbalancer_update.rb +98 -0
  122. data/lib/chef/knife/ionoscloud_nic_create.rb +17 -22
  123. data/lib/chef/knife/ionoscloud_nic_delete.rb +3 -7
  124. data/lib/chef/knife/ionoscloud_nic_get.rb +49 -0
  125. data/lib/chef/knife/ionoscloud_nic_list.rb +9 -5
  126. data/lib/chef/knife/ionoscloud_nic_update.rb +96 -0
  127. data/lib/chef/knife/ionoscloud_node_get.rb +49 -0
  128. data/lib/chef/knife/ionoscloud_node_list.rb +0 -1
  129. data/lib/chef/knife/ionoscloud_nodepool_create.rb +35 -48
  130. data/lib/chef/knife/ionoscloud_nodepool_delete.rb +1 -7
  131. data/lib/chef/knife/ionoscloud_nodepool_get.rb +43 -0
  132. data/lib/chef/knife/ionoscloud_nodepool_lan_add.rb +104 -0
  133. data/lib/chef/knife/ionoscloud_nodepool_lan_remove.rb +72 -0
  134. data/lib/chef/knife/ionoscloud_nodepool_list.rb +3 -1
  135. data/lib/chef/knife/ionoscloud_nodepool_update.rb +124 -0
  136. data/lib/chef/knife/ionoscloud_pcc_create.rb +12 -18
  137. data/lib/chef/knife/ionoscloud_pcc_delete.rb +2 -10
  138. data/lib/chef/knife/ionoscloud_pcc_get.rb +33 -0
  139. data/lib/chef/knife/ionoscloud_pcc_list.rb +1 -1
  140. data/lib/chef/knife/ionoscloud_pcc_update.rb +63 -0
  141. data/lib/chef/knife/ionoscloud_request_get.rb +40 -0
  142. data/lib/chef/knife/ionoscloud_request_list.rb +1 -1
  143. data/lib/chef/knife/ionoscloud_request_status.rb +1 -1
  144. data/lib/chef/knife/ionoscloud_s3key_create.rb +3 -7
  145. data/lib/chef/knife/ionoscloud_s3key_delete.rb +4 -7
  146. data/lib/chef/knife/ionoscloud_s3key_get.rb +38 -0
  147. data/lib/chef/knife/ionoscloud_s3key_list.rb +2 -2
  148. data/lib/chef/knife/ionoscloud_server_console.rb +43 -0
  149. data/lib/chef/knife/ionoscloud_server_create.rb +14 -26
  150. data/lib/chef/knife/ionoscloud_server_delete.rb +3 -9
  151. data/lib/chef/knife/ionoscloud_server_get.rb +43 -0
  152. data/lib/chef/knife/ionoscloud_server_list.rb +16 -5
  153. data/lib/chef/knife/ionoscloud_server_reboot.rb +1 -1
  154. data/lib/chef/knife/ionoscloud_server_resume.rb +44 -0
  155. data/lib/chef/knife/ionoscloud_server_start.rb +1 -1
  156. data/lib/chef/knife/ionoscloud_server_stop.rb +1 -1
  157. data/lib/chef/knife/ionoscloud_server_suspend.rb +45 -0
  158. data/lib/chef/knife/ionoscloud_server_token.rb +43 -0
  159. data/lib/chef/knife/ionoscloud_server_update.rb +97 -0
  160. data/lib/chef/knife/ionoscloud_server_upgrade.rb +45 -0
  161. data/lib/chef/knife/ionoscloud_share_create.rb +7 -11
  162. data/lib/chef/knife/ionoscloud_share_delete.rb +2 -3
  163. data/lib/chef/knife/ionoscloud_share_get.rb +38 -0
  164. data/lib/chef/knife/ionoscloud_share_update.rb +70 -0
  165. data/lib/chef/knife/ionoscloud_snapshot_create.rb +2 -10
  166. data/lib/chef/knife/ionoscloud_snapshot_delete.rb +2 -7
  167. data/lib/chef/knife/ionoscloud_snapshot_get.rb +32 -0
  168. data/lib/chef/knife/ionoscloud_snapshot_list.rb +1 -1
  169. data/lib/chef/knife/ionoscloud_snapshot_restore.rb +3 -14
  170. data/lib/chef/knife/ionoscloud_snapshot_update.rb +126 -0
  171. data/lib/chef/knife/ionoscloud_template_list.rb +47 -0
  172. data/lib/chef/knife/ionoscloud_user_create.rb +1 -8
  173. data/lib/chef/knife/ionoscloud_user_delete.rb +1 -6
  174. data/lib/chef/knife/ionoscloud_user_get.rb +32 -0
  175. data/lib/chef/knife/ionoscloud_user_ssourl.rb +1 -1
  176. data/lib/chef/knife/ionoscloud_user_update.rb +92 -0
  177. data/lib/chef/knife/ionoscloud_volume_attach.rb +1 -1
  178. data/lib/chef/knife/ionoscloud_volume_create.rb +18 -34
  179. data/lib/chef/knife/ionoscloud_volume_delete.rb +3 -9
  180. data/lib/chef/knife/ionoscloud_volume_detach.rb +1 -1
  181. data/lib/chef/knife/ionoscloud_volume_get.rb +36 -0
  182. data/lib/chef/knife/ionoscloud_volume_list.rb +2 -2
  183. data/lib/chef/knife/ionoscloud_volume_update.rb +106 -0
  184. data/lib/knife-ionoscloud/version.rb +1 -1
  185. data/spec/chef/knife/ionoscloud_backupunit_create_spec.rb +2 -2
  186. data/spec/chef/knife/ionoscloud_backupunit_delete_spec.rb +5 -5
  187. data/spec/chef/knife/ionoscloud_backupunit_get_spec.rb +65 -0
  188. data/spec/chef/knife/ionoscloud_backupunit_list_spec.rb +1 -1
  189. data/spec/chef/knife/ionoscloud_backupunit_ssourl_spec.rb +3 -3
  190. data/spec/chef/knife/ionoscloud_backupunit_update_spec.rb +78 -0
  191. data/spec/chef/knife/ionoscloud_base_spec.rb +4 -4
  192. data/spec/chef/knife/ionoscloud_composite_server_create_spec.rb +11 -8
  193. data/spec/chef/knife/ionoscloud_contract_list_spec.rb +32 -27
  194. data/spec/chef/knife/ionoscloud_cube_server_create_spec.rb +249 -0
  195. data/spec/chef/knife/ionoscloud_datacenter_create_spec.rb +6 -2
  196. data/spec/chef/knife/ionoscloud_datacenter_delete_spec.rb +8 -5
  197. data/spec/chef/knife/ionoscloud_datacenter_get_spec.rb +69 -0
  198. data/spec/chef/knife/ionoscloud_datacenter_list_spec.rb +5 -3
  199. data/spec/chef/knife/ionoscloud_datacenter_update_spec.rb +82 -0
  200. data/spec/chef/knife/ionoscloud_firewall_create_spec.rb +5 -3
  201. data/spec/chef/knife/ionoscloud_firewall_delete_spec.rb +6 -5
  202. data/spec/chef/knife/ionoscloud_firewall_get_spec.rb +77 -0
  203. data/spec/chef/knife/ionoscloud_firewall_list_spec.rb +5 -3
  204. data/spec/chef/knife/ionoscloud_firewall_update_spec.rb +117 -0
  205. data/spec/chef/knife/ionoscloud_flowlog_create_spec.rb +254 -0
  206. data/spec/chef/knife/ionoscloud_flowlog_delete_spec.rb +360 -0
  207. data/spec/chef/knife/ionoscloud_flowlog_get_spec.rb +171 -0
  208. data/spec/chef/knife/ionoscloud_flowlog_list_spec.rb +264 -0
  209. data/spec/chef/knife/ionoscloud_flowlog_update_spec.rb +244 -0
  210. data/spec/chef/knife/ionoscloud_group_create_spec.rb +9 -0
  211. data/spec/chef/knife/ionoscloud_group_delete_spec.rb +6 -0
  212. data/spec/chef/knife/ionoscloud_group_get_spec.rb +6 -0
  213. data/spec/chef/knife/ionoscloud_group_list_spec.rb +26 -8
  214. data/spec/chef/knife/ionoscloud_group_update_spec.rb +121 -0
  215. data/spec/chef/knife/ionoscloud_group_user_add_spec.rb +6 -0
  216. data/spec/chef/knife/ionoscloud_group_user_remove_spec.rb +6 -0
  217. data/spec/chef/knife/ionoscloud_image_list_spec.rb +2 -2
  218. data/spec/chef/knife/ionoscloud_ipblock_get_spec.rb +66 -0
  219. data/spec/chef/knife/ionoscloud_ipblock_update_spec.rb +79 -0
  220. data/spec/chef/knife/ionoscloud_ipfailover_add_spec.rb +4 -4
  221. data/spec/chef/knife/ionoscloud_ipfailover_remove_spec.rb +7 -7
  222. data/spec/chef/knife/ionoscloud_k8s_create_spec.rb +7 -0
  223. data/spec/chef/knife/ionoscloud_k8s_delete_spec.rb +16 -11
  224. data/spec/chef/knife/ionoscloud_k8s_get_spec.rb +72 -0
  225. data/spec/chef/knife/ionoscloud_k8s_update_spec.rb +114 -0
  226. data/spec/chef/knife/ionoscloud_kubeconfig_get_spec.rb +2 -2
  227. data/spec/chef/knife/ionoscloud_label_add_spec.rb +10 -10
  228. data/spec/chef/knife/ionoscloud_label_list_spec.rb +14 -14
  229. data/spec/chef/knife/ionoscloud_label_remove_spec.rb +20 -20
  230. data/spec/chef/knife/ionoscloud_lan_create_spec.rb +4 -3
  231. data/spec/chef/knife/ionoscloud_lan_delete_spec.rb +7 -5
  232. data/spec/chef/knife/ionoscloud_lan_get_spec.rb +68 -0
  233. data/spec/chef/knife/ionoscloud_lan_list_spec.rb +2 -2
  234. data/spec/chef/knife/ionoscloud_lan_update_spec.rb +87 -0
  235. data/spec/chef/knife/ionoscloud_loadbalancer_create_spec.rb +3 -3
  236. data/spec/chef/knife/ionoscloud_loadbalancer_delete_spec.rb +5 -5
  237. data/spec/chef/knife/ionoscloud_loadbalancer_get_spec.rb +2 -2
  238. data/spec/chef/knife/ionoscloud_loadbalancer_list_spec.rb +2 -2
  239. data/spec/chef/knife/ionoscloud_loadbalancer_nic_add_spec.rb +6 -6
  240. data/spec/chef/knife/ionoscloud_loadbalancer_nic_remove_spec.rb +6 -6
  241. data/spec/chef/knife/ionoscloud_loadbalancer_update_spec.rb +89 -0
  242. data/spec/chef/knife/ionoscloud_location_list_spec.rb +5 -3
  243. data/spec/chef/knife/ionoscloud_natgateway_create_spec.rb +92 -0
  244. data/spec/chef/knife/ionoscloud_natgateway_delete_spec.rb +118 -0
  245. data/spec/chef/knife/ionoscloud_natgateway_get_spec.rb +81 -0
  246. data/spec/chef/knife/ionoscloud_natgateway_lan_add_spec.rb +158 -0
  247. data/spec/chef/knife/ionoscloud_natgateway_lan_remove_spec.rb +209 -0
  248. data/spec/chef/knife/ionoscloud_natgateway_list_spec.rb +79 -0
  249. data/spec/chef/knife/ionoscloud_natgateway_rule_add_spec.rb +99 -0
  250. data/spec/chef/knife/ionoscloud_natgateway_rule_list_spec.rb +92 -0
  251. data/spec/chef/knife/ionoscloud_natgateway_rule_remove_spec.rb +78 -0
  252. data/spec/chef/knife/ionoscloud_natgateway_rule_update_spec.rb +121 -0
  253. data/spec/chef/knife/ionoscloud_natgateway_update_spec.rb +121 -0
  254. data/spec/chef/knife/ionoscloud_networkloadbalancer_create_spec.rb +93 -0
  255. data/spec/chef/knife/ionoscloud_networkloadbalancer_delete_spec.rb +120 -0
  256. data/spec/chef/knife/ionoscloud_networkloadbalancer_get_spec.rb +82 -0
  257. data/spec/chef/knife/ionoscloud_networkloadbalancer_list_spec.rb +88 -0
  258. data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_add_spec.rb +105 -0
  259. data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_list_spec.rb +89 -0
  260. data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_remove_spec.rb +150 -0
  261. data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_target_add_spec.rb +113 -0
  262. data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_target_list_spec.rb +85 -0
  263. data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_target_remove_spec.rb +281 -0
  264. data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_update_spec.rb +163 -0
  265. data/spec/chef/knife/ionoscloud_networkloadbalancer_update_spec.rb +107 -0
  266. data/spec/chef/knife/ionoscloud_nic_create_spec.rb +9 -5
  267. data/spec/chef/knife/ionoscloud_nic_delete_spec.rb +8 -6
  268. data/spec/chef/knife/ionoscloud_nic_get_spec.rb +72 -0
  269. data/spec/chef/knife/ionoscloud_nic_list_spec.rb +12 -6
  270. data/spec/chef/knife/ionoscloud_nic_update_spec.rb +97 -0
  271. data/spec/chef/knife/ionoscloud_node_get_spec.rb +70 -0
  272. data/spec/chef/knife/ionoscloud_nodepool_create_spec.rb +10 -5
  273. data/spec/chef/knife/ionoscloud_nodepool_delete_spec.rb +14 -0
  274. data/spec/chef/knife/ionoscloud_nodepool_get_spec.rb +83 -0
  275. data/spec/chef/knife/ionoscloud_nodepool_lan_add_spec.rb +222 -0
  276. data/spec/chef/knife/ionoscloud_nodepool_lan_remove.rb +196 -0
  277. data/spec/chef/knife/ionoscloud_nodepool_list_spec.rb +3 -1
  278. data/spec/chef/knife/ionoscloud_nodepool_update_spec.rb +134 -0
  279. data/spec/chef/knife/ionoscloud_pcc_create_spec.rb +11 -8
  280. data/spec/chef/knife/ionoscloud_pcc_delete_spec.rb +7 -7
  281. data/spec/chef/knife/ionoscloud_pcc_get_spec.rb +71 -0
  282. data/spec/chef/knife/ionoscloud_pcc_list_spec.rb +2 -2
  283. data/spec/chef/knife/ionoscloud_pcc_update_spec.rb +83 -0
  284. data/spec/chef/knife/ionoscloud_request_get_spec.rb +69 -0
  285. data/spec/chef/knife/ionoscloud_request_list_spec.rb +16 -16
  286. data/spec/chef/knife/ionoscloud_request_status_spec.rb +3 -3
  287. data/spec/chef/knife/ionoscloud_s3key_create_spec.rb +2 -2
  288. data/spec/chef/knife/ionoscloud_s3key_delete_spec.rb +5 -5
  289. data/spec/chef/knife/ionoscloud_s3key_get_spec.rb +66 -0
  290. data/spec/chef/knife/ionoscloud_s3key_list_spec.rb +2 -2
  291. data/spec/chef/knife/ionoscloud_server_console_spec.rb +97 -0
  292. data/spec/chef/knife/ionoscloud_server_create_spec.rb +6 -3
  293. data/spec/chef/knife/ionoscloud_server_delete_spec.rb +8 -5
  294. data/spec/chef/knife/ionoscloud_server_get_spec.rb +74 -0
  295. data/spec/chef/knife/ionoscloud_server_list_spec.rb +63 -5
  296. data/spec/chef/knife/ionoscloud_server_reboot_spec.rb +3 -5
  297. data/spec/chef/knife/ionoscloud_server_resume_spec.rb +93 -0
  298. data/spec/chef/knife/ionoscloud_server_start_spec.rb +3 -5
  299. data/spec/chef/knife/ionoscloud_server_stop_spec.rb +3 -5
  300. data/spec/chef/knife/ionoscloud_server_suspend_spec.rb +93 -0
  301. data/spec/chef/knife/ionoscloud_server_token_spec.rb +97 -0
  302. data/spec/chef/knife/ionoscloud_server_update_spec.rb +105 -0
  303. data/spec/chef/knife/ionoscloud_server_upgrade_spec.rb +96 -0
  304. data/spec/chef/knife/ionoscloud_share_get_spec.rb +66 -0
  305. data/spec/chef/knife/ionoscloud_share_update_spec.rb +91 -0
  306. data/spec/chef/knife/ionoscloud_snapshot_create_spec.rb +15 -3
  307. data/spec/chef/knife/ionoscloud_snapshot_delete_spec.rb +17 -5
  308. data/spec/chef/knife/ionoscloud_snapshot_get_spec.rb +79 -0
  309. data/spec/chef/knife/ionoscloud_snapshot_list_spec.rb +2 -2
  310. data/spec/chef/knife/ionoscloud_snapshot_restore_spec.rb +12 -3
  311. data/spec/chef/knife/ionoscloud_snapshot_update_spec.rb +113 -0
  312. data/spec/chef/knife/ionoscloud_template_list_spec.rb +78 -0
  313. data/spec/chef/knife/ionoscloud_user_create_spec.rb +3 -1
  314. data/spec/chef/knife/ionoscloud_user_delete_spec.rb +4 -2
  315. data/spec/chef/knife/ionoscloud_user_get_spec.rb +70 -0
  316. data/spec/chef/knife/ionoscloud_user_ssourl_spec.rb +3 -3
  317. data/spec/chef/knife/ionoscloud_user_update_spec.rb +110 -0
  318. data/spec/chef/knife/ionoscloud_volume_attach_spec.rb +4 -4
  319. data/spec/chef/knife/ionoscloud_volume_create_spec.rb +21 -11
  320. data/spec/chef/knife/ionoscloud_volume_delete_spec.rb +15 -5
  321. data/spec/chef/knife/ionoscloud_volume_detach_spec.rb +5 -5
  322. data/spec/chef/knife/ionoscloud_volume_get_spec.rb +81 -0
  323. data/spec/chef/knife/ionoscloud_volume_list_spec.rb +4 -4
  324. data/spec/chef/knife/ionoscloud_volume_update_spec.rb +116 -0
  325. data/spec/spec_helper.rb +251 -39
  326. metadata +245 -6
@@ -0,0 +1,124 @@
1
+ require_relative 'ionoscloud_base'
2
+
3
+ class Chef
4
+ class Knife
5
+ class IonoscloudNetworkloadbalancerRuleTargetAdd < Knife
6
+ include Knife::IonoscloudBase
7
+
8
+ banner 'knife ionoscloud networkloadbalancer rule target add (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 :network_loadbalancer_id,
16
+ short: '-L NETWORK_LOADBALANCER_ID',
17
+ long: '--network-loadbalancer NETWORK_LOADBALANCER_ID',
18
+ description: 'ID of the Network Loadbalancer'
19
+
20
+ option :forwarding_rule_id,
21
+ short: '-R FORWARDING_RULE_ID',
22
+ long: '--forwarding-rule FORWARDING_RULE_ID',
23
+ description: 'ID of the Network Loadbalancer Forwarding Rule'
24
+
25
+ option :ip,
26
+ short: '-i IP',
27
+ long: '--ip IP',
28
+ description: 'IP of a balanced target VM'
29
+
30
+ option :port,
31
+ short: '-p PORT',
32
+ long: '--port PORT',
33
+ description: 'Port of the balanced target service. (range: 1 to 65535)'
34
+
35
+ option :weight,
36
+ short: '-w WEIGTH',
37
+ long: '--weight WEIGTH',
38
+ description: 'Weight parameter is used to adjust the target VM\'s weight relative to other target VMs. '\
39
+ 'All target VMs will receive a load proportional to their weight relative to the sum of all weights, so '\
40
+ 'the higher the weight, the higher the load. The default weight is 1, and the maximal value is 256. A '\
41
+ 'value of 0 means the target VM will not participate in load-balancing but will still accept persistent '\
42
+ 'connections. If this parameter is used to distribute the load according to target VM\'s capacity, it is '\
43
+ 'recommended to start with values which can both grow and shrink, for instance between 10 and 100 to leave '\
44
+ 'enough room above and below for later adjustments.'
45
+
46
+ option :check,
47
+ short: '-c',
48
+ long: '--check',
49
+ description: 'Check specifies whether the target VM\'s health is checked. If turned off, a target VM is '\
50
+ 'always considered available. If turned on, the target VM is available when accepting periodic TCP connections, '\
51
+ 'to ensure that it is really able to serve requests. The address and port to send the tests to are those of the '\
52
+ 'target VM. The health check only consists of a connection attempt.',
53
+ boolean: true
54
+
55
+ option :check_interval,
56
+ long: '--check-interval CHECK_INTERVAL',
57
+ description: 'CheckInterval determines the duration (in milliseconds) between consecutive health checks. '\
58
+ 'If unspecified a default of 2000 ms is used.',
59
+ default: 2000
60
+
61
+ option :maintenance,
62
+ short: '-m',
63
+ long: '--maintenance MAINTENANCE',
64
+ description: 'Maintenance specifies if a target VM should be marked as down, even if it is not.',
65
+ boolean: true
66
+
67
+ attr_reader :description, :required_options
68
+
69
+ def initialize(args = [])
70
+ super(args)
71
+ @description =
72
+ 'Adds a target to a Network Load Balancer Forwarding Rule under a data center.'
73
+ @required_options = [
74
+ :datacenter_id, :network_loadbalancer_id, :forwarding_rule_id, :ip, :port, :weight, :ionoscloud_username, :ionoscloud_password,
75
+ ]
76
+ end
77
+
78
+ def run
79
+ $stdout.sync = true
80
+ handle_extra_config
81
+ validate_required_params(@required_options, config)
82
+
83
+ network_loadbalancers_api = Ionoscloud::NetworkLoadBalancersApi.new(api_client)
84
+
85
+
86
+ network_load_balancer_rule = network_loadbalancers_api.datacenters_networkloadbalancers_forwardingrules_find_by_forwarding_rule_id(
87
+ config[:datacenter_id], config[:network_loadbalancer_id], config[:forwarding_rule_id],
88
+ )
89
+
90
+ network_loadbalancer_forwarding_rule_target = Ionoscloud::NetworkLoadBalancerForwardingRuleTarget.new(
91
+ ip: config[:ip],
92
+ port: config[:port],
93
+ weight: config[:weight],
94
+ health_check: Ionoscloud::NetworkLoadBalancerForwardingRuleTargetHealthCheck.new(
95
+ check: config[:check],
96
+ check_interval: config[:check_interval],
97
+ maintenance: config[:maintenance],
98
+ ),
99
+ )
100
+
101
+ network_load_balancer_rule.properties.targets << network_loadbalancer_forwarding_rule_target
102
+
103
+ _, _, headers = network_loadbalancers_api.datacenters_networkloadbalancers_forwardingrules_patch_with_http_info(
104
+ config[:datacenter_id],
105
+ config[:network_loadbalancer_id],
106
+ config[:forwarding_rule_id],
107
+ Ionoscloud::NetworkLoadBalancerForwardingRuleProperties.new({
108
+ targets: network_load_balancer_rule.properties.targets,
109
+ }),
110
+ )
111
+
112
+ print "#{ui.color('Adding the target to the Network Loadbalancer Forwarding Rule...', :magenta)}"
113
+ dot = ui.color('.', :magenta)
114
+ api_client.wait_for { print dot; is_done? get_request_id headers }
115
+
116
+ print_network_load_balancer(
117
+ network_loadbalancers_api.datacenters_networkloadbalancers_find_by_network_load_balancer_id(
118
+ config[:datacenter_id], config[:network_loadbalancer_id], depth: 2,
119
+ ),
120
+ )
121
+ end
122
+ end
123
+ end
124
+ end
@@ -0,0 +1,70 @@
1
+ require_relative 'ionoscloud_base'
2
+
3
+ class Chef
4
+ class Knife
5
+ class IonoscloudNetworkloadbalancerRuleTargetList < Knife
6
+ include Knife::IonoscloudBase
7
+
8
+ banner 'knife ionoscloud networkloadbalancer rule target list (options)'
9
+
10
+ option :datacenter_id,
11
+ short: '-D DATACENTER_ID',
12
+ long: '--datacenter-id DATACENTER_ID',
13
+ description: 'The ID of the data center'
14
+
15
+ option :network_loadbalancer_id,
16
+ short: '-L NETWORK_LOADBALANCER_ID',
17
+ long: '--network-loadbalancer NETWORK_LOADBALANCER_ID',
18
+ description: 'ID of the Network Loadbalancer'
19
+
20
+ option :forwarding_rule_id,
21
+ short: '-R FORWARDING_RULE_ID',
22
+ long: '--forwarding-rule FORWARDING_RULE_ID',
23
+ description: 'ID of the Network Loadbalancer Forwarding Rule'
24
+
25
+ attr_reader :description, :required_options
26
+
27
+ def initialize(args = [])
28
+ super(args)
29
+ @description =
30
+ 'Lists all targets of a Network Loadbalancer Forwarding Rule under a data center.'
31
+ @required_options = [
32
+ :datacenter_id, :network_loadbalancer_id, :forwarding_rule_id, :ionoscloud_username, :ionoscloud_password,
33
+ ]
34
+ end
35
+
36
+ def run
37
+ $stdout.sync = true
38
+ handle_extra_config
39
+ validate_required_params(@required_options, config)
40
+
41
+ $stdout.sync = true
42
+ handle_extra_config
43
+ target_list = [
44
+ ui.color('IP', :bold),
45
+ ui.color('Port', :bold),
46
+ ui.color('Weight', :bold),
47
+ ui.color('Check', :bold),
48
+ ui.color('Check interval', :bold),
49
+ ui.color('Maintenance', :bold),
50
+ ]
51
+ network_loadbalancers_api = Ionoscloud::NetworkLoadBalancersApi.new(api_client)
52
+
53
+ network_load_balancer_rule = network_loadbalancers_api.datacenters_networkloadbalancers_forwardingrules_find_by_forwarding_rule_id(
54
+ config[:datacenter_id], config[:network_loadbalancer_id], config[:forwarding_rule_id],
55
+ )
56
+
57
+ network_load_balancer_rule.properties.targets.each do |target|
58
+ target_list << target.ip
59
+ target_list << target.port
60
+ target_list << target.weight
61
+ target_list << target.health_check.check
62
+ target_list << target.health_check.check_interval
63
+ target_list << target.health_check.maintenance
64
+ end
65
+
66
+ puts ui.list(target_list, :uneven_columns_across, 6)
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,88 @@
1
+ require_relative 'ionoscloud_base'
2
+
3
+ class Chef
4
+ class Knife
5
+ class IonoscloudNetworkloadbalancerRuleTargetRemove < Knife
6
+ include Knife::IonoscloudBase
7
+
8
+ banner 'knife ionoscloud networkloadbalancer rule target remove (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 :network_loadbalancer_id,
16
+ short: '-L NETWORK_LOADBALANCER_ID',
17
+ long: '--network-loadbalancer NETWORK_LOADBALANCER_ID',
18
+ description: 'ID of the Network Loadbalancer'
19
+
20
+ option :forwarding_rule_id,
21
+ short: '-R FORWARDING_RULE_ID',
22
+ long: '--forwarding-rule FORWARDING_RULE_ID',
23
+ description: 'ID of the Network Loadbalancer Forwarding Rule'
24
+
25
+ option :ip,
26
+ short: '-i IP',
27
+ long: '--ip IP',
28
+ description: 'IP of a balanced target VM'
29
+
30
+ option :port,
31
+ short: '-p PORT',
32
+ long: '--port PORT',
33
+ description: 'Port of the balanced target service. (range: 1 to 65535)'
34
+
35
+ attr_reader :description, :required_options
36
+
37
+ def initialize(args = [])
38
+ super(args)
39
+ @description =
40
+ 'Adds a target to a Network Load Balancer Forwarding Rule under a data center.'
41
+ @required_options = [
42
+ :datacenter_id, :network_loadbalancer_id, :forwarding_rule_id, :ip, :port, :ionoscloud_username, :ionoscloud_password,
43
+ ]
44
+ end
45
+
46
+ def run
47
+ $stdout.sync = true
48
+ handle_extra_config
49
+ validate_required_params(@required_options, config)
50
+
51
+ network_loadbalancers_api = Ionoscloud::NetworkLoadBalancersApi.new(api_client)
52
+
53
+
54
+ network_load_balancer_rule = network_loadbalancers_api.datacenters_networkloadbalancers_forwardingrules_find_by_forwarding_rule_id(
55
+ config[:datacenter_id], config[:network_loadbalancer_id], config[:forwarding_rule_id],
56
+ )
57
+
58
+ initial_length = network_load_balancer_rule.properties.targets.length
59
+
60
+ network_load_balancer_rule.properties.targets = network_load_balancer_rule.properties.targets.reject do
61
+ |target|
62
+ target.ip == config[:ip] && target.port == Integer(config[:port])
63
+ end
64
+
65
+ if initial_length > network_load_balancer_rule.properties.targets.length
66
+ _, _, headers = network_loadbalancers_api.datacenters_networkloadbalancers_forwardingrules_patch_with_http_info(
67
+ config[:datacenter_id],
68
+ config[:network_loadbalancer_id],
69
+ config[:forwarding_rule_id],
70
+ Ionoscloud::NetworkLoadBalancerForwardingRuleProperties.new({
71
+ targets: network_load_balancer_rule.properties.targets,
72
+ }),
73
+ )
74
+
75
+ print "#{ui.color('Removing the target from the Network Loadbalancer Forwarding Rule...', :magenta)}"
76
+ dot = ui.color('.', :magenta)
77
+ api_client.wait_for { print dot; is_done? get_request_id headers }
78
+ end
79
+
80
+ print_network_load_balancer(
81
+ network_loadbalancers_api.datacenters_networkloadbalancers_find_by_network_load_balancer_id(
82
+ config[:datacenter_id], config[:network_loadbalancer_id], depth: 2,
83
+ ),
84
+ )
85
+ end
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,148 @@
1
+ require_relative 'ionoscloud_base'
2
+
3
+ class Chef
4
+ class Knife
5
+ class IonoscloudNetworkloadbalancerRuleUpdate < Knife
6
+ include Knife::IonoscloudBase
7
+
8
+ banner 'knife ionoscloud networkloadbalancer rule update (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 :network_loadbalancer_id,
16
+ short: '-L NETWORK_LOADBALANCER_ID',
17
+ long: '--network-loadbalancer NETWORK_LOADBALANCER_ID',
18
+ description: 'ID of the Network Loadbalancer'
19
+
20
+ option :forwarding_rule_id,
21
+ short: '-R FORWARDING_RULE_ID',
22
+ long: '--forwarding-rule FORWARDING_RULE_ID',
23
+ description: 'ID of the Network Loadbalancer Forwarding Rule'
24
+
25
+ option :name,
26
+ short: '-n NAME',
27
+ long: '--name NAME',
28
+ description: 'A name of that Network Load Balancer forwarding rule'
29
+
30
+ option :algorithm,
31
+ short: '-a ALGORITHM',
32
+ long: '--algorithm ALGORITHM',
33
+ description: 'Algorithm for the balancing'
34
+
35
+ option :protocol,
36
+ long: '--protocol PROTOCOL',
37
+ description: 'Protocol of the balancing'
38
+
39
+ option :listener_ip,
40
+ short: '-i LISTENER_IP',
41
+ long: '--ip LISTENER_IP',
42
+ description: 'Listening IP. (inbound)'
43
+
44
+ option :listener_port,
45
+ short: '-p LISTENER_PORT',
46
+ long: '--port LISTENER_PORT',
47
+ description: 'Listening port number. (inbound) (range: 1 to 65535)'
48
+
49
+ option :client_timeout,
50
+ long: '--client-timeout CLIENT_TIMEOUT',
51
+ description: 'ClientTimeout is expressed in milliseconds. This inactivity timeout applies when '\
52
+ 'the client is expected to acknowledge or send data. If unset the default of 50 seconds will be used.'
53
+
54
+ option :connect_timeout,
55
+ long: '--connect-timeout CONNECT_TIMEOUT',
56
+ description: 'It specifies the maximum time (in milliseconds) to wait for a connection attempt to a '\
57
+ 'target VM to succeed. If unset, the default of 5 seconds will be used.'
58
+
59
+ option :target_timeout,
60
+ long: '--terget-timeout TARGET_TIMEOUT',
61
+ description: 'TargetTimeout specifies the maximum inactivity time (in milliseconds) on the target VM side. '\
62
+ 'If unset, the default of 50 seconds will be used.'
63
+
64
+ option :retries,
65
+ short: '-r RETRIES',
66
+ long: '--retries RETRIES',
67
+ description: 'Retries specifies the number of retries to perform on a target VM after a connection failure. '\
68
+ 'If unset, the default value of 3 will be used. (valid range: [0, 65535])'
69
+
70
+ option :targets,
71
+ long: '--targets TARGETS',
72
+ description: 'Array of targets'
73
+
74
+ attr_reader :description, :required_options
75
+
76
+ def initialize(args = [])
77
+ super(args)
78
+ @description =
79
+ 'Updates information about a Ionoscloud Network Load Balancer.'
80
+ @required_options = [:datacenter_id, :network_loadbalancer_id, :ionoscloud_username, :ionoscloud_password]
81
+ @updatable_fields = [
82
+ :name, :algorithm, :protocol, :listener_ip, :listener_port, :targets,
83
+ :client_timeout, :connect_timeout, :target_timeout, :retries,
84
+ ]
85
+ end
86
+
87
+ def run
88
+ $stdout.sync = true
89
+ handle_extra_config
90
+ validate_required_params(@required_options, config)
91
+
92
+ network_load_balancer_api = Ionoscloud::NetworkLoadBalancersApi.new(api_client)
93
+
94
+ config[:gateway_ips] = config[:gateway_ips].split(',') if config[:gateway_ips] && config[:gateway_ips].instance_of?(String)
95
+ config[:targets] = JSON[config[:targets]] if config[:targets] && config[:targets].instance_of?(String)
96
+
97
+ config[:targets] = config[:targets].map do
98
+ |target|
99
+ Ionoscloud::NetworkLoadBalancerForwardingRuleTarget.new(
100
+ ip: target['ip'],
101
+ port: target['port'],
102
+ weight: target['weight'],
103
+ health_check: Ionoscloud::NetworkLoadBalancerForwardingRuleTargetHealthCheck.new(
104
+ check: target['health_check']['check'],
105
+ check_interval: target['health_check']['check_interval'],
106
+ maintenance: target['health_check']['maintenance'],
107
+ ),
108
+ )
109
+ end if config[:targets]
110
+
111
+ if @updatable_fields.map { |el| config[el] }.any?
112
+ print "#{ui.color('Updating Network Load Balancer...', :magenta)}"
113
+
114
+ _, _, headers = network_load_balancer_api.datacenters_networkloadbalancers_forwardingrules_patch_with_http_info(
115
+ config[:datacenter_id],
116
+ config[:network_loadbalancer_id],
117
+ config[:forwarding_rule_id],
118
+ Ionoscloud::NetworkLoadBalancerForwardingRuleProperties.new(
119
+ name: config[:name],
120
+ algorithm: config[:algorithm],
121
+ protocol: config[:protocol],
122
+ listener_ip: config[:listener_ip],
123
+ listener_port: config[:listener_port],
124
+ targets: config[:targets],
125
+ health_check: Ionoscloud::NetworkLoadBalancerForwardingRuleHealthCheck.new(
126
+ client_timeout: config[:client_timeout],
127
+ connect_timeout: config[:connect_timeout],
128
+ target_timeout: config[:target_timeout],
129
+ retries: config[:retries],
130
+ ),
131
+ ),
132
+ )
133
+
134
+ dot = ui.color('.', :magenta)
135
+ api_client.wait_for { print dot; is_done? get_request_id headers }
136
+ else
137
+ ui.warn("Nothing to update, please set one of the attributes #{@updatable_fields}.")
138
+ end
139
+
140
+ print_network_load_balancer(
141
+ network_load_balancer_api.datacenters_networkloadbalancers_find_by_network_load_balancer_id(
142
+ config[:datacenter_id], config[:network_loadbalancer_id], depth: 2,
143
+ ),
144
+ )
145
+ end
146
+ end
147
+ end
148
+ end
@@ -0,0 +1,98 @@
1
+ require_relative 'ionoscloud_base'
2
+
3
+ class Chef
4
+ class Knife
5
+ class IonoscloudNetworkloadbalancerUpdate < Knife
6
+ include Knife::IonoscloudBase
7
+
8
+ banner 'knife ionoscloud networkloadbalancer update (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 :network_loadbalancer_id,
16
+ short: '-L NETWORK_LOADBALANCER_ID',
17
+ long: '--network-loadbalancer NETWORK_LOADBALANCER_ID',
18
+ description: 'ID of the Network Loadbalancer'
19
+
20
+ option :name,
21
+ short: '-n NAME',
22
+ long: '--name NAME',
23
+ description: 'Name of the load balancer'
24
+
25
+ option :listener_lan,
26
+ short: '-l LISTENER_LAN_ID',
27
+ long: '--listener-lan LISTENER_LAN_ID',
28
+ description: 'Id of the listening LAN. (inbound)'
29
+
30
+ option :target_lan,
31
+ short: '-t TARGET_LAN_ID',
32
+ long: '--target-lan TARGET_LAN_ID',
33
+ description: 'Id of the balanced private target LAN. (outbound)'
34
+
35
+ option :ips,
36
+ short: '-i IP[,IP,...]',
37
+ long: '--ips IP[,IP,...]',
38
+ description: 'Collection of IP addresses of the Network Load Balancer. (inbound and outbound) '\
39
+ 'IP of the listenerLan must be a customer reserved IP for the public load balancer '\
40
+ 'and private IP for the private load balancer.'
41
+
42
+ option :lb_private_ips,
43
+ long: '--private-ips IP[,IP,...]',
44
+ description: 'Collection of private IP addresses with subnet mask of the Network Load Balancer. '\
45
+ 'IPs must contain valid subnet mask. If user will not provide any IP then the system '\
46
+ 'will generate one IP with /24 subnet.'
47
+
48
+
49
+ attr_reader :description, :required_options
50
+
51
+ def initialize(args = [])
52
+ super(args)
53
+ @description =
54
+ 'Updates information about a Ionoscloud Network Load Balancer.'
55
+ @required_options = [:datacenter_id, :network_loadbalancer_id, :ionoscloud_username, :ionoscloud_password]
56
+ @updatable_fields = [:name, :listener_lan, :target_lan, :ips, :lb_private_ips]
57
+ end
58
+
59
+ def run
60
+ $stdout.sync = true
61
+ handle_extra_config
62
+ validate_required_params(@required_options, config)
63
+
64
+ config[:ips] = config[:ips].split(',') if config[:ips] && config[:ips].instance_of?(String)
65
+ config[:lb_private_ips] = config[:lb_private_ips].split(',') if config[:lb_private_ips] && config[:lb_private_ips].instance_of?(String)
66
+
67
+ network_load_balancer_api = Ionoscloud::NetworkLoadBalancersApi.new(api_client)
68
+
69
+ if @updatable_fields.map { |el| config[el] }.any?
70
+ print "#{ui.color('Updating Network Load Balancer...', :magenta)}"
71
+
72
+ _, _, headers = network_load_balancer_api.datacenters_networkloadbalancers_patch_with_http_info(
73
+ config[:datacenter_id],
74
+ config[:network_loadbalancer_id],
75
+ Ionoscloud::NetworkLoadBalancerProperties.new({
76
+ name: config[:name],
77
+ ips: config[:ips],
78
+ listener_lan: config[:listener_lan],
79
+ target_lan: config[:target_lan],
80
+ lb_private_ips: config[:lb_private_ips],
81
+ }.compact),
82
+ )
83
+
84
+ dot = ui.color('.', :magenta)
85
+ api_client.wait_for { print dot; is_done? get_request_id headers }
86
+ else
87
+ ui.warn("Nothing to update, please set one of the attributes #{@updatable_fields}.")
88
+ end
89
+
90
+ print_network_load_balancer(
91
+ network_load_balancer_api.datacenters_networkloadbalancers_find_by_network_load_balancer_id(
92
+ config[:datacenter_id], config[:network_loadbalancer_id], depth: 2,
93
+ ),
94
+ )
95
+ end
96
+ end
97
+ end
98
+ end
@@ -39,9 +39,12 @@ class Chef
39
39
  long: '--lan ID',
40
40
  description: 'The LAN ID the NIC will reside on; if the LAN ID does not exist it will be created'
41
41
 
42
- option :nat,
43
- long: '--nat',
44
- description: 'Set to enable NAT on the NIC'
42
+ option :firewall_type,
43
+ short: '-t FIREWALL_TYPE',
44
+ long: '--firewall-type FIREWALL_TYPE',
45
+ description: 'The type of firewall rules that will be allowed on the NIC. If it is not specified it will take the '\
46
+ 'default value INGRESS',
47
+ default: 'INGRESS'
45
48
 
46
49
  attr_reader :description, :required_options
47
50
 
@@ -62,40 +65,32 @@ class Chef
62
65
 
63
66
  config[:ips] = config[:ips].split(',') if config[:ips] && config[:ips].instance_of?(String)
64
67
 
65
- params = {
68
+ nic_properties = {
66
69
  name: config[:name],
67
70
  ips: config[:ips],
68
71
  dhcp: config[:dhcp],
69
72
  lan: config[:lan],
70
- nat: !config[:nat].nil?,
71
- }
73
+ firewall_type: config[:firewall_type]
74
+ }.compact
72
75
 
73
- nic_api = Ionoscloud::NicApi.new(api_client)
76
+ nic_api = Ionoscloud::NetworkInterfacesApi.new(api_client)
74
77
 
75
78
  nic, _, headers = nic_api.datacenters_servers_nics_post_with_http_info(
76
79
  config[:datacenter_id],
77
80
  config[:server_id],
78
- { properties: params.compact },
81
+ Ionoscloud::Nic.new(properties: Ionoscloud::NicProperties.new(**nic_properties)),
79
82
  )
80
83
 
81
84
  dot = ui.color('.', :magenta)
82
85
  api_client.wait_for { print dot; is_done? get_request_id headers }
83
86
 
84
- nic = nic_api.datacenters_servers_nics_find_by_id(
85
- config[:datacenter_id],
86
- config[:server_id],
87
- nic.id,
87
+ print_nic(
88
+ nic_api.datacenters_servers_nics_find_by_id(
89
+ config[:datacenter_id],
90
+ config[:server_id],
91
+ nic.id,
92
+ ),
88
93
  )
89
-
90
- puts "\n"
91
- puts "#{ui.color('ID', :cyan)}: #{nic.id}"
92
- puts "#{ui.color('Name', :cyan)}: #{nic.properties.name}"
93
- puts "#{ui.color('IPs', :cyan)}: #{nic.properties.ips.to_s}"
94
- puts "#{ui.color('DHCP', :cyan)}: #{nic.properties.dhcp}"
95
- puts "#{ui.color('LAN', :cyan)}: #{nic.properties.lan}"
96
- puts "#{ui.color('NAT', :cyan)}: #{nic.properties.nat}"
97
-
98
- puts 'done'
99
94
  end
100
95
  end
101
96
  end
@@ -31,7 +31,7 @@ class Chef
31
31
  handle_extra_config
32
32
  validate_required_params(@required_options, config)
33
33
 
34
- nic_api = Ionoscloud::NicApi.new(api_client)
34
+ nic_api = Ionoscloud::NetworkInterfacesApi.new(api_client)
35
35
  @name_args.each do |nic_id|
36
36
  begin
37
37
  nic = nic_api.datacenters_servers_nics_find_by_id(config[:datacenter_id], config[:server_id], nic_id)
@@ -41,12 +41,8 @@ class Chef
41
41
  next
42
42
  end
43
43
 
44
- msg_pair('ID', nic.id)
45
- msg_pair('Name', nic.properties.name)
46
- msg_pair('IPs', nic.properties.ips)
47
- msg_pair('DHCP', nic.properties.dhcp)
48
- msg_pair('LAN', nic.properties.lan)
49
- msg_pair('NAT', nic.properties.nat)
44
+ print_nic(nic)
45
+ puts "\n"
50
46
 
51
47
  begin
52
48
  confirm('Do you really want to delete this Nic')
@@ -0,0 +1,49 @@
1
+ require_relative 'ionoscloud_base'
2
+
3
+ class Chef
4
+ class Knife
5
+ class IonoscloudNicGet < Knife
6
+ include Knife::IonoscloudBase
7
+
8
+ banner 'knife ionoscloud nic 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 :server_id,
16
+ short: '-S SERVER_ID',
17
+ long: '--server-id SERVER_ID',
18
+ description: 'The ID of the server to which the NIC is assigned'
19
+
20
+ option :nic_id,
21
+ short: '-N NIC_ID',
22
+ long: '--nic-id NIC_ID',
23
+ description: 'ID of the load balancer'
24
+
25
+ attr_reader :description, :required_options
26
+
27
+ def initialize(args = [])
28
+ super(args)
29
+ @description =
30
+ 'Retrieves the attributes of a given NIC.'
31
+ @required_options = [:datacenter_id, :server_id, :nic_id, :ionoscloud_username, :ionoscloud_password]
32
+ end
33
+
34
+ def run
35
+ $stdout.sync = true
36
+ handle_extra_config
37
+ validate_required_params(@required_options, config)
38
+
39
+ print_nic(
40
+ Ionoscloud::NetworkInterfacesApi.new(api_client).datacenters_servers_nics_find_by_id(
41
+ config[:datacenter_id],
42
+ config[:server_id],
43
+ config[:nic_id],
44
+ ),
45
+ )
46
+ end
47
+ end
48
+ end
49
+ end