knife-ionoscloud 5.1.1 → 6.0.0.beta.2

Sign up to get free protection for your applications and to get access to all the features.
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,60 @@
1
+ require_relative 'ionoscloud_base'
2
+
3
+ class Chef
4
+ class Knife
5
+ class IonoscloudNatgatewayCreate < Knife
6
+ include Knife::IonoscloudBase
7
+
8
+ banner 'knife ionoscloud natgateway create (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 :name,
16
+ short: '-n NAME',
17
+ long: '--name NAME',
18
+ description: 'Name of the NAT gateway'
19
+
20
+ option :ips,
21
+ short: '-i IP[,IP,...]',
22
+ long: '--ips IP[,IP,...]',
23
+ description: 'Collection of public IP addresses of the NAT gateway. Should be customer reserved IP addresses in that location'
24
+
25
+ attr_reader :description, :required_options
26
+
27
+ def initialize(args = [])
28
+ super(args)
29
+ @description =
30
+ 'Creates a new Nat Gateway under a data center.'
31
+ @required_options = [:datacenter_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
+ natgateways_api = Ionoscloud::NATGatewaysApi.new(api_client)
40
+
41
+ config[:ips] = config[:ips].split(',') if config[:ips] && config[:ips].instance_of?(String)
42
+
43
+ natgateway = Ionoscloud::NatGateway.new(
44
+ properties: Ionoscloud::NatGatewayProperties.new(
45
+ name: config[:name],
46
+ public_ips: config[:ips],
47
+ )
48
+ )
49
+
50
+ natgateway, _, headers = natgateways_api.datacenters_natgateways_post_with_http_info(config[:datacenter_id], natgateway)
51
+
52
+ print "#{ui.color('Creating Nat Gateway...', :magenta)}"
53
+ dot = ui.color('.', :magenta)
54
+ api_client.wait_for { print dot; is_done? get_request_id headers }
55
+
56
+ print_natgateway(natgateways_api.datacenters_natgateways_find_by_nat_gateway_id(config[:datacenter_id], natgateway.id, depth: 2))
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,54 @@
1
+ require_relative 'ionoscloud_base'
2
+
3
+ class Chef
4
+ class Knife
5
+ class IonoscloudNatgatewayDelete < Knife
6
+ include Knife::IonoscloudBase
7
+
8
+ banner 'knife ionoscloud natgateway delete NATGATEWAY_ID [NATGATEWAY_ID] (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
+ attr_reader :description, :required_options
16
+
17
+ def initialize(args = [])
18
+ super(args)
19
+ @description =
20
+ 'Deletes an existing NAT Gateway.'
21
+ @required_options = [:datacenter_id, :ionoscloud_username, :ionoscloud_password]
22
+ end
23
+
24
+ def run
25
+ $stdout.sync = true
26
+ handle_extra_config
27
+ validate_required_params(@required_options, config)
28
+
29
+ natgateways_api = Ionoscloud::NATGatewaysApi.new(api_client)
30
+ @name_args.each do |natgateway_id|
31
+ begin
32
+ natgateway = natgateways_api.datacenters_natgateways_find_by_nat_gateway_id(config[:datacenter_id], natgateway_id, depth: 2)
33
+ rescue Ionoscloud::ApiError => err
34
+ raise err unless err.code == 404
35
+ ui.error("NAT Gateway ID #{natgateway_id} not found. Skipping.")
36
+ next
37
+ end
38
+
39
+ print_natgateway(natgateway)
40
+ puts "\n"
41
+
42
+ begin
43
+ confirm('Do you really want to delete this NAT Gateway')
44
+ rescue SystemExit => exc
45
+ next
46
+ end
47
+
48
+ _, _, headers = natgateways_api.datacenters_natgateways_delete_with_http_info(config[:datacenter_id], natgateway.id)
49
+ ui.warn("Deleted NAT Gateway #{natgateway.id}. Request ID: #{get_request_id headers}")
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,42 @@
1
+ require_relative 'ionoscloud_base'
2
+
3
+ class Chef
4
+ class Knife
5
+ class IonoscloudNatgatewayGet < Knife
6
+ include Knife::IonoscloudBase
7
+
8
+ banner 'knife ionoscloud natgateway get (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 :natgateway_id,
16
+ short: '-G NATGATEWAY_ID',
17
+ long: '--natgateway-id NATGATEWAY_ID',
18
+ description: 'ID of the NAT Gateway'
19
+
20
+ attr_reader :description, :required_options
21
+
22
+ def initialize(args = [])
23
+ super(args)
24
+ @description =
25
+ 'Retrieves the attributes of a given NAT Gateway.'
26
+ @required_options = [:datacenter_id, :natgateway_id, :ionoscloud_username, :ionoscloud_password]
27
+ end
28
+
29
+ def run
30
+ $stdout.sync = true
31
+ handle_extra_config
32
+ validate_required_params(@required_options, config)
33
+
34
+ natgateways_api = Ionoscloud::NATGatewaysApi.new(api_client)
35
+
36
+ print_natgateway(
37
+ natgateways_api.datacenters_natgateways_find_by_nat_gateway_id(config[:datacenter_id], config[:natgateway_id], depth: 2),
38
+ )
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,74 @@
1
+ require_relative 'ionoscloud_base'
2
+
3
+ class Chef
4
+ class Knife
5
+ class IonoscloudNatgatewayLanAdd < Knife
6
+ include Knife::IonoscloudBase
7
+
8
+ banner 'knife ionoscloud natgateway lan 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 :natgateway_id,
16
+ short: '-G NATGATEWAY_ID',
17
+ long: '--natgateway-id NATGATEWAY_ID',
18
+ description: 'ID of the NAT Gateway'
19
+
20
+ option :lan_id,
21
+ short: '-L LAN_ID',
22
+ long: '--lan LAN_ID',
23
+ description: 'ID of the LAN'
24
+
25
+ option :gateway_ips,
26
+ short: '-i IP[,IP,...]',
27
+ long: '--ips IP[,IP,...]',
28
+ description: 'Collection of gateway IP addresses of the NAT gateway. '\
29
+ 'Will be auto-generated if not provided. Should ideally be an IP belonging to the same subnet as the LAN'
30
+
31
+ attr_reader :description, :required_options
32
+
33
+ def initialize(args = [])
34
+ super(args)
35
+ @description =
36
+ 'Adds a LAN to a Nat Gateway under a data center.'
37
+ @required_options = [:datacenter_id, :natgateway_id, :lan_id, :ionoscloud_username, :ionoscloud_password]
38
+ end
39
+
40
+ def run
41
+ $stdout.sync = true
42
+ handle_extra_config
43
+ validate_required_params(@required_options, config)
44
+
45
+ natgateways_api = Ionoscloud::NATGatewaysApi.new(api_client)
46
+
47
+ config[:gateway_ips] = config[:gateway_ips].split(',') if config[:gateway_ips] && config[:gateway_ips].instance_of?(String)
48
+
49
+ natgateway = natgateways_api.datacenters_natgateways_find_by_nat_gateway_id(config[:datacenter_id], config[:natgateway_id])
50
+
51
+ existing_lan = natgateway.properties.lans.find { |lan| lan.id == Integer(config[:lan_id]) }
52
+
53
+ if existing_lan
54
+ existing_lan.gateway_ips = config[:gateway_ips]
55
+ else
56
+ natgateway.properties.lans.append(
57
+ Ionoscloud::NatGatewayLanProperties.new(
58
+ id: Integer(config[:lan_id]),
59
+ gateway_ips: config[:gateway_ips],
60
+ ),
61
+ )
62
+ end
63
+
64
+ _, _, headers = natgateways_api.datacenters_natgateways_patch_with_http_info(config[:datacenter_id], config[:natgateway_id], natgateway.properties)
65
+
66
+ print "#{ui.color('Adding the LAN to the Nat Gateway...', :magenta)}"
67
+ dot = ui.color('.', :magenta)
68
+ api_client.wait_for { print dot; is_done? get_request_id headers }
69
+
70
+ print_natgateway(natgateways_api.datacenters_natgateways_find_by_nat_gateway_id(config[:datacenter_id], config[:natgateway_id]))
71
+ end
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,52 @@
1
+ require_relative 'ionoscloud_base'
2
+
3
+ class Chef
4
+ class Knife
5
+ class IonoscloudNatgatewayLanRemove < Knife
6
+ include Knife::IonoscloudBase
7
+
8
+ banner 'knife ionoscloud natgateway lan remove LAN_ID [LAN_ID] (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 :natgateway_id,
16
+ short: '-G NATGATEWAY_ID',
17
+ long: '--natgateway-id NATGATEWAY_ID',
18
+ description: 'ID of the NAT Gateway'
19
+
20
+ attr_reader :description, :required_options
21
+
22
+ def initialize(args = [])
23
+ super(args)
24
+ @description =
25
+ 'Removes the specified LANS from a Nat Gateway under a data center.'
26
+ @required_options = [:datacenter_id, :natgateway_id, :ionoscloud_username, :ionoscloud_password]
27
+ end
28
+
29
+ def run
30
+ $stdout.sync = true
31
+ handle_extra_config
32
+ validate_required_params(@required_options, config)
33
+
34
+ return unless @name_args.length > 0
35
+
36
+ natgateways_api = Ionoscloud::NATGatewaysApi.new(api_client)
37
+
38
+ natgateway = natgateways_api.datacenters_natgateways_find_by_nat_gateway_id(config[:datacenter_id], config[:natgateway_id])
39
+
40
+ natgateway.properties.lans = natgateway.properties.lans.reject { |lan| @name_args.map { |el| Integer(el) }.include? lan.id }
41
+
42
+ natgateway, _, headers = natgateways_api.datacenters_natgateways_patch_with_http_info(config[:datacenter_id], config[:natgateway_id], natgateway.properties)
43
+
44
+ print "#{ui.color("Removing LANS #{@name_args} from the NAT Gateway...", :magenta)}"
45
+ dot = ui.color('.', :magenta)
46
+ api_client.wait_for { print dot; is_done? get_request_id headers }
47
+
48
+ print_natgateway(natgateways_api.datacenters_natgateways_find_by_nat_gateway_id(config[:datacenter_id], natgateway.id))
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,51 @@
1
+ require_relative 'ionoscloud_base'
2
+
3
+ class Chef
4
+ class Knife
5
+ class IonoscloudNatgatewayList < Knife
6
+ include Knife::IonoscloudBase
7
+
8
+ banner 'knife ionoscloud natgateway 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
+ attr_reader :description, :required_options
16
+
17
+ def initialize(args = [])
18
+ super(args)
19
+ @description =
20
+ 'Lists all available NAT Gateways under a data center.'
21
+ @required_options = [:datacenter_id, :ionoscloud_username, :ionoscloud_password]
22
+ end
23
+
24
+ def run
25
+ $stdout.sync = true
26
+ handle_extra_config
27
+ validate_required_params(@required_options, config)
28
+
29
+ $stdout.sync = true
30
+ handle_extra_config
31
+ natgateway_list = [
32
+ ui.color('ID', :bold),
33
+ ui.color('Name', :bold),
34
+ ui.color('IPS', :bold),
35
+ ui.color('LANS', :bold),
36
+ ui.color('Rules Count', :bold),
37
+ ]
38
+ natgateways_api = Ionoscloud::NATGatewaysApi.new(api_client)
39
+
40
+ natgateways_api.datacenters_natgateways_get(config[:datacenter_id], { depth: 3 }).items.each do |natgateway|
41
+ natgateway_list << natgateway.id
42
+ natgateway_list << natgateway.properties.name
43
+ natgateway_list << natgateway.properties.public_ips
44
+ natgateway_list << natgateway.properties.lans.map { |el| { id: el.id, gateway_ips: el.gateway_ips } }
45
+ natgateway_list << natgateway.entities.rules.items.length
46
+ end
47
+ puts ui.list(natgateway_list, :uneven_columns_across, 5)
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,107 @@
1
+ require_relative 'ionoscloud_base'
2
+
3
+ class Chef
4
+ class Knife
5
+ class IonoscloudNatgatewayRuleAdd < Knife
6
+ include Knife::IonoscloudBase
7
+
8
+ banner 'knife ionoscloud natgateway rule 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 :natgateway_id,
16
+ short: '-G NATGATEWAY_ID',
17
+ long: '--natgateway-id NATGATEWAY_ID',
18
+ description: 'ID of the NAT Gateway'
19
+
20
+ option :name,
21
+ short: '-n NAME',
22
+ long: '--name NAME',
23
+ description: 'Name of the NAT gateway rule'
24
+
25
+ option :type,
26
+ short: '-t TYPE',
27
+ long: '--type TYPE',
28
+ description: 'Type of the NAT gateway rule',
29
+ default: 'SNAT'
30
+
31
+ option :protocol,
32
+ short: '-p PROTOCOL',
33
+ long: '--protocol PROTOCOL',
34
+ description: "Protocol of the NAT gateway rule. Defaults to ALL. If protocol is "\
35
+ "'ICMP' then target_port_range start and end cannot be set.",
36
+ default: 'ALL'
37
+
38
+ option :source_subnet,
39
+ long: '--source SOURCE_SUBNET',
40
+ description: 'Source subnet of the NAT gateway rule. For SNAT rules it specifies '\
41
+ 'which packets this translation rule applies to based on the packets source IP address.'
42
+
43
+ option :public_ip,
44
+ short: '-i PUBLIC_IP',
45
+ long: '--ip PUBLIC_IP',
46
+ description: 'Public IP address of the NAT gateway rule. Specifies the address used for masking outgoing '\
47
+ 'packets source address field. Should be one of the customer reserved IP address already configured on the NAT gateway resource'
48
+
49
+ option :target_subnet,
50
+ long: '--target TARGET_SUBNET',
51
+ description: 'Target or destination subnet of the NAT gateway rule. For SNAT rules it specifies which packets '\
52
+ 'this translation rule applies to based on the packets destination IP address. If none is provided, rule will match any address'
53
+
54
+ option :target_port_range_start,
55
+ long: '--port-start PORT_RANGE_START',
56
+ description: 'Target port range start associated with the NAT gateway rule'
57
+
58
+ option :target_port_range_end,
59
+ long: '--port-end PORT_RANGE_START',
60
+ description: 'Target port range end associated with the NAT gateway rule'
61
+
62
+ attr_reader :description, :required_options
63
+
64
+ def initialize(args = [])
65
+ super(args)
66
+ @description =
67
+ 'Adds a Rule to a Nat Gateway under a data center.'
68
+ @required_options = [:datacenter_id, :natgateway_id, :name, :source_subnet, :public_ip, :ionoscloud_username, :ionoscloud_password]
69
+ end
70
+
71
+ def run
72
+ $stdout.sync = true
73
+ handle_extra_config
74
+ validate_required_params(@required_options, config)
75
+
76
+ natgateways_api = Ionoscloud::NATGatewaysApi.new(api_client)
77
+
78
+ natgateway_rule = Ionoscloud::NatGatewayRule.new(
79
+ properties: Ionoscloud::NatGatewayRuleProperties.new(
80
+ name: config[:name],
81
+ type: config[:type],
82
+ protocol: config[:protocol],
83
+ public_ip: config[:public_ip],
84
+ source_subnet: config[:source_subnet],
85
+ target_subnet: config[:target_subnet],
86
+ target_port_range: Ionoscloud::TargetPortRange.new(
87
+ start: config[:target_port_range_start],
88
+ _end: config[:target_port_range_end],
89
+ ),
90
+ ),
91
+ )
92
+
93
+ _, _, headers = natgateways_api.datacenters_natgateways_rules_post_with_http_info(
94
+ config[:datacenter_id], config[:natgateway_id], natgateway_rule,
95
+ )
96
+
97
+ print "#{ui.color('Adding the rule to the Nat Gateway...', :magenta)}"
98
+ dot = ui.color('.', :magenta)
99
+ api_client.wait_for { print dot; is_done? get_request_id headers }
100
+
101
+ print_natgateway(
102
+ natgateways_api.datacenters_natgateways_find_by_nat_gateway_id(config[:datacenter_id], config[:natgateway_id], depth: 2),
103
+ )
104
+ end
105
+ end
106
+ end
107
+ end
@@ -0,0 +1,65 @@
1
+ require_relative 'ionoscloud_base'
2
+
3
+ class Chef
4
+ class Knife
5
+ class IonoscloudNatgatewayRuleList < Knife
6
+ include Knife::IonoscloudBase
7
+
8
+ banner 'knife ionoscloud natgateway rule 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 :natgateway_id,
16
+ short: '-G NATGATEWAY_ID',
17
+ long: '--natgateway-id NATGATEWAY_ID',
18
+ description: 'ID of the NAT Gateway'
19
+
20
+ attr_reader :description, :required_options
21
+
22
+ def initialize(args = [])
23
+ super(args)
24
+ @description =
25
+ 'Lists all available rules in a NAT Gateways under a data center.'
26
+ @required_options = [:datacenter_id, :ionoscloud_username, :ionoscloud_password]
27
+ end
28
+
29
+ def run
30
+ $stdout.sync = true
31
+ handle_extra_config
32
+ validate_required_params(@required_options, config)
33
+
34
+ $stdout.sync = true
35
+ handle_extra_config
36
+ natgateway_rules_list = [
37
+ ui.color('ID', :bold),
38
+ ui.color('Name', :bold),
39
+ ui.color('Type', :bold),
40
+ ui.color('Protocol', :bold),
41
+ ui.color('Public IP', :bold),
42
+ ui.color('Source Subnet', :bold),
43
+ ui.color('Target Subnet', :bold),
44
+ ui.color('Target Port Range Start', :bold),
45
+ ui.color('Target Port Range End', :bold),
46
+ ]
47
+ natgateways_api = Ionoscloud::NATGatewaysApi.new(api_client)
48
+
49
+ natgateways_api.datacenters_natgateways_rules_get(config[:datacenter_id], config[:natgateway_id], { depth: 1 }).items.each do |natgateway_rule|
50
+ natgateway_rules_list << natgateway_rule.id
51
+ natgateway_rules_list << natgateway_rule.properties.name
52
+ natgateway_rules_list << natgateway_rule.properties.type
53
+ natgateway_rules_list << natgateway_rule.properties.protocol
54
+ natgateway_rules_list << natgateway_rule.properties.public_ip
55
+ natgateway_rules_list << natgateway_rule.properties.source_subnet
56
+ natgateway_rules_list << natgateway_rule.properties.target_subnet
57
+ natgateway_rules_list << (natgateway_rule.properties.target_port_range ? natgateway_rule.properties.target_port_range.start : '')
58
+ natgateway_rules_list << (natgateway_rule.properties.target_port_range ? natgateway_rule.properties.target_port_range._end : '')
59
+ end
60
+
61
+ puts ui.list(natgateway_rules_list, :uneven_columns_across, 9)
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,55 @@
1
+ require_relative 'ionoscloud_base'
2
+
3
+ class Chef
4
+ class Knife
5
+ class IonoscloudNatgatewayRuleRemove < Knife
6
+ include Knife::IonoscloudBase
7
+
8
+ banner 'knife ionoscloud natgateway rule remove RULE_ID [RULE_ID] (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 :natgateway_id,
16
+ short: '-G NATGATEWAY_ID',
17
+ long: '--natgateway-id NATGATEWAY_ID',
18
+ description: 'ID of the NAT Gateway'
19
+
20
+ attr_reader :description, :required_options
21
+
22
+ def initialize(args = [])
23
+ super(args)
24
+ @description =
25
+ 'Removes the specified rules from a Nat Gateway under a data center.'
26
+ @required_options = [:datacenter_id, :natgateway_id, :ionoscloud_username, :ionoscloud_password]
27
+ end
28
+
29
+ def run
30
+ $stdout.sync = true
31
+ handle_extra_config
32
+ validate_required_params(@required_options, config)
33
+
34
+ return unless @name_args.length > 0
35
+
36
+ natgateways_api = Ionoscloud::NATGatewaysApi.new(api_client)
37
+
38
+ headers_to_wait = []
39
+ @name_args.each do |rule_id|
40
+ _, _, headers = natgateways_api.datacenters_natgateways_rules_delete_with_http_info(config[:datacenter_id], config[:natgateway_id], rule_id)
41
+ headers_to_wait << headers
42
+ end
43
+
44
+ print "#{ui.color("Removing rules #{@name_args} from the NAT Gateway...", :magenta)}"
45
+ dot = ui.color('.', :magenta)
46
+
47
+ headers_to_wait.each { |headers| api_client.wait_for { print dot; is_done? get_request_id headers } }
48
+
49
+ print_natgateway(
50
+ natgateways_api.datacenters_natgateways_find_by_nat_gateway_id(config[:datacenter_id], config[:natgateway_id], depth: 2),
51
+ )
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,116 @@
1
+ require_relative 'ionoscloud_base'
2
+
3
+ class Chef
4
+ class Knife
5
+ class IonoscloudNatgatewayRuleUpdate < Knife
6
+ include Knife::IonoscloudBase
7
+
8
+ banner 'knife ionoscloud natgateway 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 :natgateway_id,
16
+ short: '-G NATGATEWAY_ID',
17
+ long: '--natgateway-id NATGATEWAY_ID',
18
+ description: 'ID of the NAT Gateway'
19
+
20
+ option :natgateway_rule_id,
21
+ short: '-R RULE_ID',
22
+ long: '--rule-id RULE_ID',
23
+ description: 'ID of the NAT Gateway Rule'
24
+
25
+ option :name,
26
+ short: '-n NAME',
27
+ long: '--name NAME',
28
+ description: 'Name of the NAT gateway rule'
29
+
30
+ option :type,
31
+ short: '-t TYPE',
32
+ long: '--type TYPE',
33
+ description: 'Type of the NAT gateway rule'
34
+
35
+ option :protocol,
36
+ short: '-p PROTOCOL',
37
+ long: '--protocol PROTOCOL',
38
+ description: "Protocol of the NAT gateway rule. Defaults to ALL. If protocol is "\
39
+ "'ICMP' then target_port_range start and end cannot be set."
40
+
41
+ option :source_subnet,
42
+ long: '--source SOURCE_SUBNET',
43
+ description: 'Source subnet of the NAT gateway rule. For SNAT rules it specifies '\
44
+ 'which packets this translation rule applies to based on the packets source IP address.'
45
+
46
+ option :public_ip,
47
+ short: '-i PUBLIC_IP',
48
+ long: '--ip PUBLIC_IP',
49
+ description: 'Public IP address of the NAT gateway rule. Specifies the address used for masking outgoing '\
50
+ 'packets source address field. Should be one of the customer reserved IP address already configured on the NAT gateway resource'
51
+
52
+ option :target_subnet,
53
+ long: '--target TARGET_SUBNET',
54
+ description: 'Target or destination subnet of the NAT gateway rule. For SNAT rules it specifies which packets '\
55
+ 'this translation rule applies to based on the packets destination IP address. If none is provided, rule will match any address'
56
+
57
+ option :target_port_range_start,
58
+ long: '--port-start PORT_RANGE_START',
59
+ description: 'Target port range start associated with the NAT gateway rule'
60
+
61
+ option :target_port_range_end,
62
+ long: '--port-end PORT_RANGE_START',
63
+ description: 'Target port range end associated with the NAT gateway rule'
64
+
65
+ attr_reader :description, :required_options
66
+
67
+ def initialize(args = [])
68
+ super(args)
69
+ @description =
70
+ 'Updates information about a Ionoscloud NAT Gateway.'
71
+ @required_options = [:datacenter_id, :natgateway_id, :ionoscloud_username, :ionoscloud_password]
72
+ @updatable_fields = [
73
+ :name, :type, :protocol, :source_subnet, :public_ip, :target_subnet,
74
+ :target_port_range_start, :target_port_range_end,
75
+ ]
76
+ end
77
+
78
+ def run
79
+ $stdout.sync = true
80
+ handle_extra_config
81
+ validate_required_params(@required_options, config)
82
+
83
+ natgateways_api = Ionoscloud::NATGatewaysApi.new(api_client)
84
+
85
+ if @updatable_fields.map { |el| config[el] }.any?
86
+ print "#{ui.color('Updating NAT Gateway Rule...', :magenta)}"
87
+
88
+ _, _, headers = natgateways_api.datacenters_natgateways_rules_patch_with_http_info(
89
+ config[:datacenter_id],
90
+ config[:natgateway_id],
91
+ config[:natgateway_rule_id],
92
+ Ionoscloud::NatGatewayRuleProperties.new(
93
+ name: config[:name],
94
+ type: config[:type],
95
+ protocol: config[:protocol],
96
+ public_ip: config[:public_ip],
97
+ source_subnet: config[:source_subnet],
98
+ target_subnet: config[:target_subnet],
99
+ target_port_range: Ionoscloud::TargetPortRange.new(
100
+ start: config[:target_port_range_start],
101
+ _end: config[:target_port_range_end],
102
+ ),
103
+ ),
104
+ )
105
+
106
+ dot = ui.color('.', :magenta)
107
+ api_client.wait_for { print dot; is_done? get_request_id headers }
108
+ else
109
+ ui.warn("Nothing to update, please set one of the attributes #{@updatable_fields}.")
110
+ end
111
+
112
+ print_natgateway(natgateways_api.datacenters_natgateways_find_by_nat_gateway_id(config[:datacenter_id], config[:natgateway_id], depth: 2))
113
+ end
114
+ end
115
+ end
116
+ end