knife-ionoscloud 6.0.0.alpha.1 → 6.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (434) hide show
  1. checksums.yaml +4 -4
  2. data/.github/IONOS.CLOUD.BLU.svg +1 -0
  3. data/.github/workflows/publish.yml +4 -1
  4. data/README.md +9 -0
  5. data/docs/README.md +37 -0
  6. data/docs/changelog.md +10 -0
  7. data/docs/docs_generator.rb +45 -10
  8. data/docs/subcommands/{backupunit_create.md → backup/backupunit_create.md} +7 -1
  9. data/docs/subcommands/{backupunit_delete.md → backup/backupunit_delete.md} +7 -1
  10. data/docs/subcommands/backup/backupunit_get.md +38 -0
  11. data/docs/subcommands/{backupunit_list.md → backup/backupunit_list.md} +7 -1
  12. data/docs/subcommands/{backupunit_ssourl.md → backup/backupunit_ssourl.md} +7 -1
  13. data/docs/subcommands/backup/backupunit_update.md +44 -0
  14. data/docs/subcommands/{composite_server_create.md → compute-engine/composite_server_create.md} +15 -3
  15. data/docs/subcommands/compute-engine/cube_server_create.md +94 -0
  16. data/docs/subcommands/{datacenter_create.md → compute-engine/datacenter_create.md} +7 -1
  17. data/docs/subcommands/{datacenter_delete.md → compute-engine/datacenter_delete.md} +7 -1
  18. data/docs/subcommands/compute-engine/datacenter_get.md +38 -0
  19. data/docs/subcommands/{datacenter_list.md → compute-engine/datacenter_list.md} +7 -1
  20. data/docs/subcommands/compute-engine/datacenter_update.md +47 -0
  21. data/docs/subcommands/{firewall_create.md → compute-engine/firewall_create.md} +11 -2
  22. data/docs/subcommands/{firewall_delete.md → compute-engine/firewall_delete.md} +6 -0
  23. data/docs/subcommands/compute-engine/firewall_get.md +50 -0
  24. data/docs/subcommands/{firewall_list.md → compute-engine/firewall_list.md} +7 -1
  25. data/docs/subcommands/compute-engine/firewall_update.md +74 -0
  26. data/docs/subcommands/compute-engine/flowlog_create.md +66 -0
  27. data/docs/subcommands/compute-engine/flowlog_delete.md +54 -0
  28. data/docs/subcommands/compute-engine/flowlog_get.md +58 -0
  29. data/docs/subcommands/compute-engine/flowlog_list.md +54 -0
  30. data/docs/subcommands/compute-engine/flowlog_update.md +70 -0
  31. data/docs/subcommands/{image_list.md → compute-engine/image_list.md} +7 -1
  32. data/docs/subcommands/{ipblock_create.md → compute-engine/ipblock_create.md} +7 -1
  33. data/docs/subcommands/{ipblock_delete.md → compute-engine/ipblock_delete.md} +7 -1
  34. data/docs/subcommands/compute-engine/ipblock_get.md +38 -0
  35. data/docs/subcommands/{ipblock_list.md → compute-engine/ipblock_list.md} +7 -1
  36. data/docs/subcommands/compute-engine/ipblock_update.md +41 -0
  37. data/docs/subcommands/{ipfailover_add.md → compute-engine/ipfailover_add.md} +7 -1
  38. data/docs/subcommands/{ipfailover_remove.md → compute-engine/ipfailover_remove.md} +7 -1
  39. data/docs/subcommands/{label_add.md → compute-engine/label_add.md} +7 -1
  40. data/docs/subcommands/{label_list.md → compute-engine/label_list.md} +7 -1
  41. data/docs/subcommands/{label_remove.md → compute-engine/label_remove.md} +6 -0
  42. data/docs/subcommands/{lan_create.md → compute-engine/lan_create.md} +7 -1
  43. data/docs/subcommands/{lan_delete.md → compute-engine/lan_delete.md} +6 -0
  44. data/docs/subcommands/compute-engine/lan_get.md +42 -0
  45. data/docs/subcommands/{lan_list.md → compute-engine/lan_list.md} +7 -1
  46. data/docs/subcommands/compute-engine/lan_update.md +51 -0
  47. data/docs/subcommands/{loadbalancer_create.md → compute-engine/loadbalancer_create.md} +7 -1
  48. data/docs/subcommands/{loadbalancer_delete.md → compute-engine/loadbalancer_delete.md} +6 -0
  49. data/docs/subcommands/{loadbalancer_get.md → compute-engine/loadbalancer_get.md} +7 -1
  50. data/docs/subcommands/{loadbalancer_list.md → compute-engine/loadbalancer_list.md} +7 -1
  51. data/docs/subcommands/{loadbalancer_nic_add.md → compute-engine/loadbalancer_nic_add.md} +6 -0
  52. data/docs/subcommands/{loadbalancer_nic_remove.md → compute-engine/loadbalancer_nic_remove.md} +6 -0
  53. data/docs/subcommands/compute-engine/loadbalancer_update.md +51 -0
  54. data/docs/subcommands/{location_list.md → compute-engine/location_list.md} +7 -1
  55. data/docs/subcommands/compute-engine/natgateway_create.md +44 -0
  56. data/docs/subcommands/compute-engine/natgateway_delete.md +38 -0
  57. data/docs/subcommands/compute-engine/natgateway_get.md +42 -0
  58. data/docs/subcommands/compute-engine/natgateway_lan_add.md +49 -0
  59. data/docs/subcommands/compute-engine/natgateway_lan_remove.md +42 -0
  60. data/docs/subcommands/compute-engine/natgateway_list.md +38 -0
  61. data/docs/subcommands/compute-engine/natgateway_rule_add.md +69 -0
  62. data/docs/subcommands/compute-engine/natgateway_rule_list.md +41 -0
  63. data/docs/subcommands/compute-engine/natgateway_rule_remove.md +42 -0
  64. data/docs/subcommands/compute-engine/natgateway_rule_update.md +69 -0
  65. data/docs/subcommands/compute-engine/natgateway_update.md +51 -0
  66. data/docs/subcommands/compute-engine/networkloadbalancer_create.md +57 -0
  67. data/docs/subcommands/compute-engine/networkloadbalancer_delete.md +38 -0
  68. data/docs/subcommands/compute-engine/networkloadbalancer_get.md +42 -0
  69. data/docs/subcommands/compute-engine/networkloadbalancer_list.md +38 -0
  70. data/docs/subcommands/compute-engine/networkloadbalancer_rule_add.md +75 -0
  71. data/docs/subcommands/compute-engine/networkloadbalancer_rule_list.md +42 -0
  72. data/docs/subcommands/compute-engine/networkloadbalancer_rule_remove.md +42 -0
  73. data/docs/subcommands/compute-engine/networkloadbalancer_rule_target_add.md +67 -0
  74. data/docs/subcommands/compute-engine/networkloadbalancer_rule_target_list.md +46 -0
  75. data/docs/subcommands/compute-engine/networkloadbalancer_rule_target_remove.md +54 -0
  76. data/docs/subcommands/compute-engine/networkloadbalancer_rule_update.md +75 -0
  77. data/docs/subcommands/compute-engine/networkloadbalancer_update.md +57 -0
  78. data/docs/subcommands/{nic_create.md → compute-engine/nic_create.md} +9 -3
  79. data/docs/subcommands/{nic_delete.md → compute-engine/nic_delete.md} +6 -0
  80. data/docs/subcommands/compute-engine/nic_get.md +46 -0
  81. data/docs/subcommands/{nic_list.md → compute-engine/nic_list.md} +7 -1
  82. data/docs/subcommands/compute-engine/nic_update.md +61 -0
  83. data/docs/subcommands/{pcc_create.md → compute-engine/pcc_create.md} +7 -1
  84. data/docs/subcommands/{pcc_delete.md → compute-engine/pcc_delete.md} +7 -1
  85. data/docs/subcommands/compute-engine/pcc_get.md +38 -0
  86. data/docs/subcommands/{pcc_list.md → compute-engine/pcc_list.md} +7 -1
  87. data/docs/subcommands/compute-engine/pcc_update.md +44 -0
  88. data/docs/subcommands/compute-engine/request_get.md +38 -0
  89. data/docs/subcommands/{request_list.md → compute-engine/request_list.md} +7 -1
  90. data/docs/subcommands/{request_status.md → compute-engine/request_status.md} +7 -1
  91. data/docs/subcommands/{request_wait.md → compute-engine/request_wait.md} +7 -1
  92. data/docs/subcommands/compute-engine/server_console.md +42 -0
  93. data/docs/subcommands/{server_create.md → compute-engine/server_create.md} +7 -1
  94. data/docs/subcommands/{server_delete.md → compute-engine/server_delete.md} +6 -0
  95. data/docs/subcommands/compute-engine/server_get.md +42 -0
  96. data/docs/subcommands/{server_list.md → compute-engine/server_list.md} +10 -1
  97. data/docs/subcommands/{server_reboot.md → compute-engine/server_reboot.md} +6 -0
  98. data/docs/subcommands/compute-engine/server_resume.md +38 -0
  99. data/docs/subcommands/{server_start.md → compute-engine/server_start.md} +6 -0
  100. data/docs/subcommands/{server_stop.md → compute-engine/server_stop.md} +6 -0
  101. data/docs/subcommands/compute-engine/server_suspend.md +38 -0
  102. data/docs/subcommands/compute-engine/server_token.md +42 -0
  103. data/docs/subcommands/compute-engine/server_update.md +63 -0
  104. data/docs/subcommands/compute-engine/server_upgrade.md +42 -0
  105. data/docs/subcommands/{snapshot_create.md → compute-engine/snapshot_create.md} +7 -1
  106. data/docs/subcommands/{snapshot_delete.md → compute-engine/snapshot_delete.md} +7 -1
  107. data/docs/subcommands/compute-engine/snapshot_get.md +38 -0
  108. data/docs/subcommands/{snapshot_list.md → compute-engine/snapshot_list.md} +7 -1
  109. data/docs/subcommands/{snapshot_restore.md → compute-engine/snapshot_restore.md} +7 -1
  110. data/docs/subcommands/compute-engine/snapshot_update.md +80 -0
  111. data/docs/subcommands/compute-engine/template_list.md +34 -0
  112. data/docs/subcommands/{volume_attach.md → compute-engine/volume_attach.md} +6 -0
  113. data/docs/subcommands/{volume_create.md → compute-engine/volume_create.md} +14 -5
  114. data/docs/subcommands/{volume_delete.md → compute-engine/volume_delete.md} +6 -0
  115. data/docs/subcommands/{volume_detach.md → compute-engine/volume_detach.md} +6 -0
  116. data/docs/subcommands/compute-engine/volume_get.md +42 -0
  117. data/docs/subcommands/{volume_list.md → compute-engine/volume_list.md} +7 -1
  118. data/docs/subcommands/compute-engine/volume_update.md +69 -0
  119. data/docs/subcommands/dbaas-postgres/dbaas_postgres_backup_get.md +38 -0
  120. data/docs/subcommands/dbaas-postgres/dbaas_postgres_backup_list.md +38 -0
  121. data/docs/subcommands/dbaas-postgres/dbaas_postgres_cluster_create.md +100 -0
  122. data/docs/subcommands/dbaas-postgres/dbaas_postgres_cluster_delete.md +34 -0
  123. data/docs/subcommands/dbaas-postgres/dbaas_postgres_cluster_get.md +38 -0
  124. data/docs/subcommands/dbaas-postgres/dbaas_postgres_cluster_list.md +34 -0
  125. data/docs/subcommands/dbaas-postgres/dbaas_postgres_cluster_restore.md +44 -0
  126. data/docs/subcommands/dbaas-postgres/dbaas_postgres_cluster_update.md +65 -0
  127. data/docs/subcommands/dbaas-postgres/dbaas_postgres_logs_get.md +47 -0
  128. data/docs/subcommands/dbaas-postgres/dbaas_postgres_version_list.md +38 -0
  129. data/docs/subcommands/kubernetes/k8s_create.md +53 -0
  130. data/docs/subcommands/{k8s_delete.md → kubernetes/k8s_delete.md} +7 -1
  131. data/docs/subcommands/kubernetes/k8s_get.md +38 -0
  132. data/docs/subcommands/{k8s_list.md → kubernetes/k8s_list.md} +7 -1
  133. data/docs/subcommands/kubernetes/k8s_update.md +56 -0
  134. data/docs/subcommands/{kubeconfig_get.md → kubernetes/kubeconfig_get.md} +7 -1
  135. data/docs/subcommands/{node_delete.md → kubernetes/node_delete.md} +6 -0
  136. data/docs/subcommands/kubernetes/node_get.md +46 -0
  137. data/docs/subcommands/{node_list.md → kubernetes/node_list.md} +7 -1
  138. data/docs/subcommands/{node_replace.md → kubernetes/node_replace.md} +6 -0
  139. data/docs/subcommands/{nodepool_create.md → kubernetes/nodepool_create.md} +16 -1
  140. data/docs/subcommands/{nodepool_delete.md → kubernetes/nodepool_delete.md} +6 -0
  141. data/docs/subcommands/kubernetes/nodepool_get.md +42 -0
  142. data/docs/subcommands/kubernetes/nodepool_lan_add.md +52 -0
  143. data/docs/subcommands/kubernetes/nodepool_lan_remove.md +42 -0
  144. data/docs/subcommands/{nodepool_list.md → kubernetes/nodepool_list.md} +7 -1
  145. data/docs/subcommands/kubernetes/nodepool_update.md +72 -0
  146. data/docs/subcommands/{contract_list.md → user/contract_list.md} +7 -1
  147. data/docs/subcommands/{group_create.md → user/group_create.md} +16 -1
  148. data/docs/subcommands/{group_delete.md → user/group_delete.md} +7 -1
  149. data/docs/subcommands/{group_get.md → user/group_get.md} +7 -1
  150. data/docs/subcommands/{group_list.md → user/group_list.md} +7 -1
  151. data/docs/subcommands/user/group_update.md +77 -0
  152. data/docs/subcommands/{group_user_add.md → user/group_user_add.md} +6 -0
  153. data/docs/subcommands/{group_user_remove.md → user/group_user_remove.md} +6 -0
  154. data/docs/subcommands/{resource_list.md → user/resource_list.md} +7 -1
  155. data/docs/subcommands/{s3key_create.md → user/s3key_create.md} +7 -1
  156. data/docs/subcommands/{s3key_delete.md → user/s3key_delete.md} +6 -0
  157. data/docs/subcommands/user/s3key_get.md +42 -0
  158. data/docs/subcommands/{s3key_list.md → user/s3key_list.md} +7 -1
  159. data/docs/subcommands/{share_create.md → user/share_create.md} +7 -1
  160. data/docs/subcommands/{share_delete.md → user/share_delete.md} +6 -0
  161. data/docs/subcommands/user/share_get.md +42 -0
  162. data/docs/subcommands/{share_list.md → user/share_list.md} +7 -1
  163. data/docs/subcommands/user/share_update.md +48 -0
  164. data/docs/subcommands/{user_create.md → user/user_create.md} +7 -1
  165. data/docs/subcommands/{user_delete.md → user/user_delete.md} +7 -1
  166. data/docs/subcommands/user/user_get.md +38 -0
  167. data/docs/subcommands/{user_list.md → user/user_list.md} +7 -1
  168. data/docs/subcommands/{user_ssourl.md → user/user_ssourl.md} +7 -1
  169. data/docs/subcommands/user/user_update.md +59 -0
  170. data/docs/summary.md +167 -82
  171. data/docs/templates/summary.mustache +6 -3
  172. data/knife-ionoscloud.gemspec +2 -1
  173. data/lib/chef/knife/ionoscloud_backupunit_create.rb +12 -16
  174. data/lib/chef/knife/ionoscloud_backupunit_delete.rb +3 -6
  175. data/lib/chef/knife/ionoscloud_backupunit_get.rb +32 -0
  176. data/lib/chef/knife/ionoscloud_backupunit_list.rb +2 -2
  177. data/lib/chef/knife/ionoscloud_backupunit_ssourl.rb +2 -2
  178. data/lib/chef/knife/ionoscloud_backupunit_update.rb +61 -0
  179. data/lib/chef/knife/ionoscloud_base.rb +417 -1
  180. data/lib/chef/knife/ionoscloud_composite_server_create.rb +7 -11
  181. data/lib/chef/knife/ionoscloud_contract_list.rb +2 -2
  182. data/lib/chef/knife/ionoscloud_cube_server_create.rb +7 -11
  183. data/lib/chef/knife/ionoscloud_datacenter_create.rb +12 -15
  184. data/lib/chef/knife/ionoscloud_datacenter_delete.rb +3 -8
  185. data/lib/chef/knife/ionoscloud_datacenter_get.rb +32 -0
  186. data/lib/chef/knife/ionoscloud_datacenter_list.rb +2 -2
  187. data/lib/chef/knife/ionoscloud_datacenter_update.rb +66 -0
  188. data/lib/chef/knife/ionoscloud_dbaas_postgres_backup_get.rb +33 -0
  189. data/lib/chef/knife/ionoscloud_dbaas_postgres_backup_list.rb +59 -0
  190. data/lib/chef/knife/ionoscloud_dbaas_postgres_cluster_create.rb +158 -0
  191. data/lib/chef/knife/ionoscloud_dbaas_postgres_cluster_delete.rb +49 -0
  192. data/lib/chef/knife/ionoscloud_dbaas_postgres_cluster_get.rb +34 -0
  193. data/lib/chef/knife/ionoscloud_dbaas_postgres_cluster_list.rb +53 -0
  194. data/lib/chef/knife/ionoscloud_dbaas_postgres_cluster_restore.rb +48 -0
  195. data/lib/chef/knife/ionoscloud_dbaas_postgres_cluster_update.rb +102 -0
  196. data/lib/chef/knife/ionoscloud_dbaas_postgres_logs_get.rb +59 -0
  197. data/lib/chef/knife/ionoscloud_dbaas_postgres_version_list.rb +49 -0
  198. data/lib/chef/knife/ionoscloud_firewall_create.rb +10 -24
  199. data/lib/chef/knife/ionoscloud_firewall_delete.rb +4 -13
  200. data/lib/chef/knife/ionoscloud_firewall_get.rb +51 -0
  201. data/lib/chef/knife/ionoscloud_firewall_list.rb +2 -2
  202. data/lib/chef/knife/ionoscloud_firewall_update.rb +131 -0
  203. data/lib/chef/knife/ionoscloud_flowlog_create.rb +6 -14
  204. data/lib/chef/knife/ionoscloud_flowlog_delete.rb +10 -14
  205. data/lib/chef/knife/ionoscloud_flowlog_get.rb +83 -0
  206. data/lib/chef/knife/ionoscloud_flowlog_list.rb +4 -4
  207. data/lib/chef/knife/ionoscloud_flowlog_update.rb +124 -0
  208. data/lib/chef/knife/ionoscloud_group_create.rb +3 -18
  209. data/lib/chef/knife/ionoscloud_group_delete.rb +3 -20
  210. data/lib/chef/knife/ionoscloud_group_get.rb +3 -21
  211. data/lib/chef/knife/ionoscloud_group_list.rb +2 -2
  212. data/lib/chef/knife/ionoscloud_group_update.rb +130 -0
  213. data/lib/chef/knife/ionoscloud_group_user_add.rb +3 -20
  214. data/lib/chef/knife/ionoscloud_group_user_remove.rb +3 -20
  215. data/lib/chef/knife/ionoscloud_image_list.rb +2 -2
  216. data/lib/chef/knife/ionoscloud_ipblock_create.rb +12 -15
  217. data/lib/chef/knife/ionoscloud_ipblock_delete.rb +3 -6
  218. data/lib/chef/knife/ionoscloud_ipblock_get.rb +32 -0
  219. data/lib/chef/knife/ionoscloud_ipblock_list.rb +2 -2
  220. data/lib/chef/knife/ionoscloud_ipblock_update.rb +56 -0
  221. data/lib/chef/knife/ionoscloud_ipfailover_add.rb +3 -3
  222. data/lib/chef/knife/ionoscloud_ipfailover_remove.rb +3 -3
  223. data/lib/chef/knife/ionoscloud_k8s_create.rb +28 -36
  224. data/lib/chef/knife/ionoscloud_k8s_delete.rb +3 -11
  225. data/lib/chef/knife/ionoscloud_k8s_get.rb +32 -0
  226. data/lib/chef/knife/ionoscloud_k8s_list.rb +2 -2
  227. data/lib/chef/knife/ionoscloud_k8s_update.rb +98 -0
  228. data/lib/chef/knife/ionoscloud_kubeconfig_get.rb +2 -2
  229. data/lib/chef/knife/ionoscloud_label_add.rb +2 -2
  230. data/lib/chef/knife/ionoscloud_label_list.rb +2 -2
  231. data/lib/chef/knife/ionoscloud_label_remove.rb +2 -2
  232. data/lib/chef/knife/ionoscloud_lan_create.rb +8 -17
  233. data/lib/chef/knife/ionoscloud_lan_delete.rb +5 -6
  234. data/lib/chef/knife/ionoscloud_lan_get.rb +37 -0
  235. data/lib/chef/knife/ionoscloud_lan_list.rb +4 -3
  236. data/lib/chef/knife/ionoscloud_lan_update.rb +75 -0
  237. data/lib/chef/knife/ionoscloud_loadbalancer_create.rb +7 -16
  238. data/lib/chef/knife/ionoscloud_loadbalancer_delete.rb +3 -10
  239. data/lib/chef/knife/ionoscloud_loadbalancer_get.rb +4 -14
  240. data/lib/chef/knife/ionoscloud_loadbalancer_list.rb +2 -2
  241. data/lib/chef/knife/ionoscloud_loadbalancer_nic_add.rb +4 -16
  242. data/lib/chef/knife/ionoscloud_loadbalancer_nic_remove.rb +4 -17
  243. data/lib/chef/knife/ionoscloud_loadbalancer_update.rb +72 -0
  244. data/lib/chef/knife/ionoscloud_location_list.rb +2 -2
  245. data/lib/chef/knife/ionoscloud_natgateway_create.rb +7 -19
  246. data/lib/chef/knife/ionoscloud_natgateway_delete.rb +4 -20
  247. data/lib/chef/knife/ionoscloud_natgateway_get.rb +41 -0
  248. data/lib/chef/knife/ionoscloud_natgateway_lan_add.rb +4 -13
  249. data/lib/chef/knife/ionoscloud_natgateway_lan_remove.rb +3 -10
  250. data/lib/chef/knife/ionoscloud_natgateway_list.rb +3 -2
  251. data/lib/chef/knife/ionoscloud_natgateway_rule_add.rb +8 -28
  252. data/lib/chef/knife/ionoscloud_natgateway_rule_list.rb +3 -2
  253. data/lib/chef/knife/ionoscloud_natgateway_rule_remove.rb +5 -23
  254. data/lib/chef/knife/ionoscloud_natgateway_rule_update.rb +115 -0
  255. data/lib/chef/knife/ionoscloud_natgateway_update.rb +83 -0
  256. data/lib/chef/knife/ionoscloud_networkloadbalancer_create.rb +8 -15
  257. data/lib/chef/knife/ionoscloud_networkloadbalancer_delete.rb +4 -24
  258. data/lib/chef/knife/ionoscloud_networkloadbalancer_get.rb +41 -0
  259. data/lib/chef/knife/ionoscloud_networkloadbalancer_list.rb +2 -2
  260. data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_add.rb +32 -48
  261. data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_list.rb +3 -2
  262. data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_remove.rb +21 -32
  263. data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_target_add.rb +7 -26
  264. data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_target_list.rb +3 -2
  265. data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_target_remove.rb +6 -24
  266. data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_update.rb +147 -0
  267. data/lib/chef/knife/ionoscloud_networkloadbalancer_update.rb +97 -0
  268. data/lib/chef/knife/ionoscloud_nic_create.rb +10 -24
  269. data/lib/chef/knife/ionoscloud_nic_delete.rb +4 -10
  270. data/lib/chef/knife/ionoscloud_nic_get.rb +48 -0
  271. data/lib/chef/knife/ionoscloud_nic_list.rb +2 -2
  272. data/lib/chef/knife/ionoscloud_nic_update.rb +95 -0
  273. data/lib/chef/knife/ionoscloud_node_delete.rb +2 -2
  274. data/lib/chef/knife/ionoscloud_node_get.rb +48 -0
  275. data/lib/chef/knife/ionoscloud_node_list.rb +2 -2
  276. data/lib/chef/knife/ionoscloud_node_replace.rb +2 -2
  277. data/lib/chef/knife/ionoscloud_nodepool_create.rb +27 -59
  278. data/lib/chef/knife/ionoscloud_nodepool_delete.rb +3 -34
  279. data/lib/chef/knife/ionoscloud_nodepool_get.rb +42 -0
  280. data/lib/chef/knife/ionoscloud_nodepool_lan_add.rb +4 -32
  281. data/lib/chef/knife/ionoscloud_nodepool_lan_remove.rb +3 -28
  282. data/lib/chef/knife/ionoscloud_nodepool_list.rb +2 -2
  283. data/lib/chef/knife/ionoscloud_nodepool_update.rb +123 -0
  284. data/lib/chef/knife/ionoscloud_pcc_create.rb +13 -19
  285. data/lib/chef/knife/ionoscloud_pcc_delete.rb +3 -11
  286. data/lib/chef/knife/ionoscloud_pcc_get.rb +32 -0
  287. data/lib/chef/knife/ionoscloud_pcc_list.rb +2 -2
  288. data/lib/chef/knife/ionoscloud_pcc_update.rb +62 -0
  289. data/lib/chef/knife/ionoscloud_request_get.rb +39 -0
  290. data/lib/chef/knife/ionoscloud_request_list.rb +2 -2
  291. data/lib/chef/knife/ionoscloud_request_status.rb +2 -2
  292. data/lib/chef/knife/ionoscloud_request_wait.rb +2 -2
  293. data/lib/chef/knife/ionoscloud_resource_list.rb +2 -2
  294. data/lib/chef/knife/ionoscloud_s3key_create.rb +3 -7
  295. data/lib/chef/knife/ionoscloud_s3key_delete.rb +3 -6
  296. data/lib/chef/knife/ionoscloud_s3key_get.rb +37 -0
  297. data/lib/chef/knife/ionoscloud_s3key_list.rb +2 -2
  298. data/lib/chef/knife/ionoscloud_server_console.rb +2 -2
  299. data/lib/chef/knife/ionoscloud_server_create.rb +16 -30
  300. data/lib/chef/knife/ionoscloud_server_delete.rb +4 -10
  301. data/lib/chef/knife/ionoscloud_server_get.rb +42 -0
  302. data/lib/chef/knife/ionoscloud_server_list.rb +2 -2
  303. data/lib/chef/knife/ionoscloud_server_reboot.rb +2 -2
  304. data/lib/chef/knife/ionoscloud_server_resume.rb +2 -2
  305. data/lib/chef/knife/ionoscloud_server_start.rb +2 -2
  306. data/lib/chef/knife/ionoscloud_server_stop.rb +2 -2
  307. data/lib/chef/knife/ionoscloud_server_suspend.rb +2 -2
  308. data/lib/chef/knife/ionoscloud_server_token.rb +2 -2
  309. data/lib/chef/knife/ionoscloud_server_update.rb +96 -0
  310. data/lib/chef/knife/ionoscloud_server_upgrade.rb +2 -2
  311. data/lib/chef/knife/ionoscloud_share_create.rb +9 -13
  312. data/lib/chef/knife/ionoscloud_share_delete.rb +4 -5
  313. data/lib/chef/knife/ionoscloud_share_get.rb +37 -0
  314. data/lib/chef/knife/ionoscloud_share_list.rb +2 -2
  315. data/lib/chef/knife/ionoscloud_share_update.rb +69 -0
  316. data/lib/chef/knife/ionoscloud_snapshot_create.rb +3 -11
  317. data/lib/chef/knife/ionoscloud_snapshot_delete.rb +3 -8
  318. data/lib/chef/knife/ionoscloud_snapshot_get.rb +31 -0
  319. data/lib/chef/knife/ionoscloud_snapshot_list.rb +2 -2
  320. data/lib/chef/knife/ionoscloud_snapshot_restore.rb +3 -14
  321. data/lib/chef/knife/ionoscloud_snapshot_update.rb +125 -0
  322. data/lib/chef/knife/ionoscloud_template_list.rb +2 -2
  323. data/lib/chef/knife/ionoscloud_user_create.rb +3 -10
  324. data/lib/chef/knife/ionoscloud_user_delete.rb +3 -8
  325. data/lib/chef/knife/ionoscloud_user_get.rb +31 -0
  326. data/lib/chef/knife/ionoscloud_user_list.rb +2 -2
  327. data/lib/chef/knife/ionoscloud_user_ssourl.rb +2 -2
  328. data/lib/chef/knife/ionoscloud_user_update.rb +91 -0
  329. data/lib/chef/knife/ionoscloud_volume_attach.rb +2 -2
  330. data/lib/chef/knife/ionoscloud_volume_create.rb +4 -15
  331. data/lib/chef/knife/ionoscloud_volume_delete.rb +4 -10
  332. data/lib/chef/knife/ionoscloud_volume_detach.rb +2 -2
  333. data/lib/chef/knife/ionoscloud_volume_get.rb +35 -0
  334. data/lib/chef/knife/ionoscloud_volume_list.rb +2 -2
  335. data/lib/chef/knife/ionoscloud_volume_update.rb +105 -0
  336. data/lib/knife-ionoscloud/version.rb +1 -1
  337. data/spec/chef/knife/ionoscloud_backupunit_get_spec.rb +65 -0
  338. data/spec/chef/knife/ionoscloud_backupunit_update_spec.rb +78 -0
  339. data/spec/chef/knife/ionoscloud_datacenter_create_spec.rb +3 -0
  340. data/spec/chef/knife/ionoscloud_datacenter_delete_spec.rb +3 -0
  341. data/spec/chef/knife/ionoscloud_datacenter_get_spec.rb +69 -0
  342. data/spec/chef/knife/ionoscloud_datacenter_update_spec.rb +82 -0
  343. data/spec/chef/knife/ionoscloud_dbaas_postgres_backup_get_spec.rb +67 -0
  344. data/spec/chef/knife/ionoscloud_dbaas_postgres_backup_list_spec.rb +111 -0
  345. data/spec/chef/knife/ionoscloud_dbaas_postgres_cluster_create_spec.rb +99 -0
  346. data/spec/chef/knife/ionoscloud_dbaas_postgres_cluster_delete_spec.rb +109 -0
  347. data/spec/chef/knife/ionoscloud_dbaas_postgres_cluster_get_spec.rb +73 -0
  348. data/spec/chef/knife/ionoscloud_dbaas_postgres_cluster_list_spec.rb +84 -0
  349. data/spec/chef/knife/ionoscloud_dbaas_postgres_cluster_restore_spec.rb +59 -0
  350. data/spec/chef/knife/ionoscloud_dbaas_postgres_cluster_update_spec.rb +89 -0
  351. data/spec/chef/knife/ionoscloud_dbaas_postgres_logs_get_spec.rb +67 -0
  352. data/spec/chef/knife/ionoscloud_dbaas_postgres_version_list_spec.rb +94 -0
  353. data/spec/chef/knife/ionoscloud_firewall_create_spec.rb +1 -1
  354. data/spec/chef/knife/ionoscloud_firewall_delete_spec.rb +1 -1
  355. data/spec/chef/knife/ionoscloud_firewall_get_spec.rb +77 -0
  356. data/spec/chef/knife/ionoscloud_firewall_update_spec.rb +117 -0
  357. data/spec/chef/knife/ionoscloud_flowlog_create_spec.rb +3 -3
  358. data/spec/chef/knife/ionoscloud_flowlog_delete_spec.rb +10 -10
  359. data/spec/chef/knife/ionoscloud_flowlog_get_spec.rb +171 -0
  360. data/spec/chef/knife/ionoscloud_flowlog_list_spec.rb +3 -3
  361. data/spec/chef/knife/ionoscloud_flowlog_update_spec.rb +244 -0
  362. data/spec/chef/knife/ionoscloud_group_create_spec.rb +3 -0
  363. data/spec/chef/knife/ionoscloud_group_update_spec.rb +121 -0
  364. data/spec/chef/knife/ionoscloud_group_user_add_spec.rb +6 -0
  365. data/spec/chef/knife/ionoscloud_group_user_remove_spec.rb +6 -0
  366. data/spec/chef/knife/ionoscloud_ipblock_get_spec.rb +66 -0
  367. data/spec/chef/knife/ionoscloud_ipblock_update_spec.rb +79 -0
  368. data/spec/chef/knife/ionoscloud_ipfailover_add_spec.rb +4 -4
  369. data/spec/chef/knife/ionoscloud_ipfailover_remove_spec.rb +7 -7
  370. data/spec/chef/knife/ionoscloud_k8s_create_spec.rb +7 -0
  371. data/spec/chef/knife/ionoscloud_k8s_delete_spec.rb +16 -11
  372. data/spec/chef/knife/ionoscloud_k8s_get_spec.rb +72 -0
  373. data/spec/chef/knife/ionoscloud_k8s_update_spec.rb +114 -0
  374. data/spec/chef/knife/ionoscloud_lan_create_spec.rb +4 -3
  375. data/spec/chef/knife/ionoscloud_lan_delete_spec.rb +7 -5
  376. data/spec/chef/knife/ionoscloud_lan_get_spec.rb +68 -0
  377. data/spec/chef/knife/ionoscloud_lan_list_spec.rb +2 -2
  378. data/spec/chef/knife/ionoscloud_lan_update_spec.rb +87 -0
  379. data/spec/chef/knife/ionoscloud_loadbalancer_update_spec.rb +89 -0
  380. data/spec/chef/knife/ionoscloud_natgateway_create_spec.rb +15 -0
  381. data/spec/chef/knife/ionoscloud_natgateway_get_spec.rb +81 -0
  382. data/spec/chef/knife/ionoscloud_natgateway_lan_add_spec.rb +15 -0
  383. data/spec/chef/knife/ionoscloud_natgateway_lan_remove_spec.rb +15 -0
  384. data/spec/chef/knife/ionoscloud_natgateway_rule_add_spec.rb +1 -0
  385. data/spec/chef/knife/ionoscloud_natgateway_rule_remove_spec.rb +1 -0
  386. data/spec/chef/knife/ionoscloud_natgateway_rule_update_spec.rb +121 -0
  387. data/spec/chef/knife/ionoscloud_natgateway_update_spec.rb +121 -0
  388. data/spec/chef/knife/ionoscloud_networkloadbalancer_create_spec.rb +13 -0
  389. data/spec/chef/knife/ionoscloud_networkloadbalancer_delete_spec.rb +3 -2
  390. data/spec/chef/knife/ionoscloud_networkloadbalancer_get_spec.rb +82 -0
  391. data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_add_spec.rb +4 -3
  392. data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_remove_spec.rb +70 -44
  393. data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_target_add_spec.rb +26 -22
  394. data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_target_remove_spec.rb +79 -61
  395. data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_update_spec.rb +163 -0
  396. data/spec/chef/knife/ionoscloud_networkloadbalancer_update_spec.rb +107 -0
  397. data/spec/chef/knife/ionoscloud_nic_get_spec.rb +72 -0
  398. data/spec/chef/knife/ionoscloud_nic_update_spec.rb +97 -0
  399. data/spec/chef/knife/ionoscloud_node_get_spec.rb +70 -0
  400. data/spec/chef/knife/ionoscloud_nodepool_create_spec.rb +8 -17
  401. data/spec/chef/knife/ionoscloud_nodepool_delete_spec.rb +14 -0
  402. data/spec/chef/knife/ionoscloud_nodepool_get_spec.rb +83 -0
  403. data/spec/chef/knife/ionoscloud_nodepool_lan_add_spec.rb +29 -33
  404. data/spec/chef/knife/ionoscloud_nodepool_lan_remove.rb +14 -17
  405. data/spec/chef/knife/ionoscloud_nodepool_update_spec.rb +134 -0
  406. data/spec/chef/knife/ionoscloud_pcc_create_spec.rb +7 -4
  407. data/spec/chef/knife/ionoscloud_pcc_delete_spec.rb +2 -2
  408. data/spec/chef/knife/ionoscloud_pcc_get_spec.rb +71 -0
  409. data/spec/chef/knife/ionoscloud_pcc_update_spec.rb +83 -0
  410. data/spec/chef/knife/ionoscloud_request_get_spec.rb +69 -0
  411. data/spec/chef/knife/ionoscloud_s3key_get_spec.rb +66 -0
  412. data/spec/chef/knife/ionoscloud_server_create_spec.rb +3 -0
  413. data/spec/chef/knife/ionoscloud_server_delete_spec.rb +3 -0
  414. data/spec/chef/knife/ionoscloud_server_get_spec.rb +74 -0
  415. data/spec/chef/knife/ionoscloud_server_update_spec.rb +105 -0
  416. data/spec/chef/knife/ionoscloud_share_get_spec.rb +66 -0
  417. data/spec/chef/knife/ionoscloud_share_update_spec.rb +91 -0
  418. data/spec/chef/knife/ionoscloud_snapshot_create_spec.rb +12 -0
  419. data/spec/chef/knife/ionoscloud_snapshot_delete_spec.rb +12 -0
  420. data/spec/chef/knife/ionoscloud_snapshot_get_spec.rb +79 -0
  421. data/spec/chef/knife/ionoscloud_snapshot_restore_spec.rb +9 -0
  422. data/spec/chef/knife/ionoscloud_snapshot_update_spec.rb +113 -0
  423. data/spec/chef/knife/ionoscloud_user_create_spec.rb +3 -1
  424. data/spec/chef/knife/ionoscloud_user_delete_spec.rb +4 -2
  425. data/spec/chef/knife/ionoscloud_user_get_spec.rb +70 -0
  426. data/spec/chef/knife/ionoscloud_user_update_spec.rb +110 -0
  427. data/spec/chef/knife/ionoscloud_volume_create_spec.rb +15 -5
  428. data/spec/chef/knife/ionoscloud_volume_delete_spec.rb +10 -0
  429. data/spec/chef/knife/ionoscloud_volume_get_spec.rb +81 -0
  430. data/spec/chef/knife/ionoscloud_volume_update_spec.rb +116 -0
  431. data/spec/spec_helper.rb +148 -23
  432. metadata +336 -90
  433. data/docs/subcommands/k8s_create.md +0 -47
  434. data/spec/test.sh +0 -3
@@ -0,0 +1,117 @@
1
+ require 'spec_helper'
2
+ require 'ionoscloud_firewall_update'
3
+
4
+ Chef::Knife::IonoscloudFirewallUpdate.load_deps
5
+
6
+ describe Chef::Knife::IonoscloudFirewallUpdate do
7
+ before :each do
8
+ subject { Chef::Knife::IonoscloudFirewallUpdate.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 FirewallRulesApi.datacenters_servers_nics_firewallrules_patch' do
16
+ firewall = firewall_mock
17
+ subject_config = {
18
+ ionoscloud_username: 'email',
19
+ ionoscloud_password: 'password',
20
+ datacenter_id: 'datacenter_id',
21
+ server_id: 'server_id',
22
+ nic_id: 'nic_id',
23
+ firewall_id: firewall.id,
24
+ name: firewall.properties.name + '_edited',
25
+ protocol: 'TCP',
26
+ source_mac: '01:11:11:11:22:00',
27
+ source_ip: '1.2.3.4',
28
+ target_ip: '2.2.3.1',
29
+ port_range_start: 100,
30
+ port_range_end: 145,
31
+ icmp_type: 15,
32
+ icmp_code: 14,
33
+ yes: true,
34
+ }
35
+
36
+ subject_config.each { |key, value| subject.config[key] = value }
37
+
38
+ expect(subject).to receive(:puts).with("ID: #{firewall.id}")
39
+ expect(subject).to receive(:puts).with("Name: #{subject_config[:name]}")
40
+ expect(subject).to receive(:puts).with("Type: #{firewall.properties.type}")
41
+ expect(subject).to receive(:puts).with("Protocol: #{subject_config[:protocol]}")
42
+ expect(subject).to receive(:puts).with("Source MAC: #{subject_config[:source_mac]}")
43
+ expect(subject).to receive(:puts).with("Source IP: #{subject_config[:source_ip]}")
44
+ expect(subject).to receive(:puts).with("Target IP: #{subject_config[:target_ip]}")
45
+ expect(subject).to receive(:puts).with("Port Range Start: #{subject_config[:port_range_start]}")
46
+ expect(subject).to receive(:puts).with("Port Range End: #{subject_config[:port_range_end]}")
47
+ expect(subject).to receive(:puts).with("ICMP Type: #{subject_config[:icmp_type]}")
48
+ expect(subject).to receive(:puts).with("ICMP Code: #{subject_config[:icmp_code]}")
49
+
50
+ firewall.properties.name = subject_config[:name]
51
+ firewall.properties.protocol = subject_config[:protocol]
52
+ firewall.properties.source_mac = subject_config[:source_mac]
53
+ firewall.properties.source_ip = subject_config[:source_ip]
54
+ firewall.properties.target_ip = subject_config[:target_ip]
55
+ firewall.properties.port_range_start = subject_config[:port_range_start]
56
+ firewall.properties.port_range_end = subject_config[:port_range_end]
57
+ firewall.properties.icmp_type = subject_config[:icmp_type]
58
+ firewall.properties.icmp_code = subject_config[:icmp_code]
59
+
60
+ expected_body = {
61
+ name: subject_config[:name],
62
+ protocol: subject_config[:protocol],
63
+ sourceMac: subject_config[:source_mac],
64
+ sourceIp: subject_config[:source_ip],
65
+ targetIp: subject_config[:target_ip],
66
+ portRangeStart: subject_config[:port_range_start],
67
+ portRangeEnd: subject_config[:port_range_end],
68
+ icmpType: subject_config[:icmp_type],
69
+ icmpCode: subject_config[:icmp_code],
70
+ }
71
+
72
+ mock_wait_for(subject)
73
+ mock_call_api(
74
+ subject,
75
+ [
76
+ {
77
+ method: 'PATCH',
78
+ path: "/datacenters/#{subject_config[:datacenter_id]}/servers/#{subject_config[:server_id]}/"\
79
+ "nics/#{subject_config[:nic_id]}/firewallrules/#{firewall.id}",
80
+ operation: :'FirewallRulesApi.datacenters_servers_nics_firewallrules_patch',
81
+ return_type: 'FirewallRule',
82
+ body: expected_body,
83
+ result: firewall,
84
+ },
85
+ {
86
+ method: 'GET',
87
+ path: "/datacenters/#{subject_config[:datacenter_id]}/servers/#{subject_config[:server_id]}/"\
88
+ "nics/#{subject_config[:nic_id]}/firewallrules/#{firewall.id}",
89
+ operation: :'FirewallRulesApi.datacenters_servers_nics_firewallrules_find_by_id',
90
+ return_type: 'FirewallRule',
91
+ result: firewall,
92
+ },
93
+ ],
94
+ )
95
+
96
+ expect { subject.run }.not_to raise_error(Exception)
97
+ end
98
+
99
+ it 'should not make any call if any required option is missing' do
100
+ required_options = subject.instance_variable_get(:@required_options)
101
+
102
+ arrays_without_one_element(required_options).each do |test_case|
103
+
104
+ test_case[:array].each { |value| subject.config[value] = 'test' }
105
+
106
+ expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
107
+ expect(subject.api_client).not_to receive(:call_api)
108
+
109
+ expect { subject.run }.to raise_error(SystemExit) do |error|
110
+ expect(error.status).to eq(1)
111
+ end
112
+
113
+ required_options.each { |value| subject.config[value] = nil }
114
+ end
115
+ end
116
+ end
117
+ end
@@ -148,7 +148,7 @@ describe Chef::Knife::IonoscloudFlowlogCreate do
148
148
  ionoscloud_password: 'password',
149
149
  datacenter_id: 'datacenter_id',
150
150
  network_loadbalancer_id: 'network_loadbalancer_id',
151
- type: 'loadbalancer',
151
+ type: 'networkloadbalancer',
152
152
  name: flowlog.properties.name,
153
153
  action: flowlog.properties.action,
154
154
  direction: flowlog.properties.direction,
@@ -187,7 +187,7 @@ describe Chef::Knife::IonoscloudFlowlogCreate do
187
187
  ionoscloud_username: 'email',
188
188
  ionoscloud_password: 'password',
189
189
  datacenter_id: 'datacenter_id',
190
- type: 'loadbalancer',
190
+ type: 'networkloadbalancer',
191
191
  name: flowlog.properties.name,
192
192
  action: flowlog.properties.action,
193
193
  direction: flowlog.properties.direction,
@@ -224,7 +224,7 @@ describe Chef::Knife::IonoscloudFlowlogCreate do
224
224
 
225
225
  subject_config.each { |key, value| subject.config[key] = value }
226
226
 
227
- expect(subject.ui).to receive(:error).with("Flow log cannot belong to #{subject_config[:type]}. Value must be one of ['nic', 'natgateway', 'loadbalancer']")
227
+ expect(subject.ui).to receive(:error).with("Flow Log cannot belong to #{subject_config[:type]}. Value must be one of ['nic', 'natgateway', 'networkloadbalancer']")
228
228
 
229
229
  expect(subject.api_client).not_to receive(:call_api)
230
230
 
@@ -32,7 +32,7 @@ describe Chef::Knife::IonoscloudFlowlogDelete do
32
32
  expect(subject).to receive(:puts).with("Action: #{flowlog.properties.action}")
33
33
  expect(subject).to receive(:puts).with("Direction: #{flowlog.properties.direction}")
34
34
  expect(subject).to receive(:puts).with("Bucket: #{flowlog.properties.bucket}")
35
- expect(subject.ui).to receive(:warn).with("Deleted flow log #{flowlog.id}. Request ID: ")
35
+ expect(subject.ui).to receive(:warn).with("Deleted Flow Log #{flowlog.id}. Request ID: ")
36
36
 
37
37
  expect(subject.api_client).not_to receive(:wait_for)
38
38
  expect(subject).to receive(:get_request_id).once
@@ -73,7 +73,7 @@ describe Chef::Knife::IonoscloudFlowlogDelete do
73
73
  subject_config.each { |key, value| subject.config[key] = value }
74
74
  subject.name_args = [flowlog_id]
75
75
 
76
- expect(subject.ui).to receive(:error).with("Flow log ID #{flowlog_id} not found. Skipping.")
76
+ expect(subject.ui).to receive(:error).with("Flow Log ID #{flowlog_id} not found. Skipping.")
77
77
 
78
78
  expect(subject.api_client).not_to receive(:wait_for)
79
79
  mock_call_api(
@@ -133,7 +133,7 @@ describe Chef::Knife::IonoscloudFlowlogDelete do
133
133
  expect(subject).to receive(:puts).with("Action: #{flowlog.properties.action}")
134
134
  expect(subject).to receive(:puts).with("Direction: #{flowlog.properties.direction}")
135
135
  expect(subject).to receive(:puts).with("Bucket: #{flowlog.properties.bucket}")
136
- expect(subject.ui).to receive(:warn).with("Deleted flow log #{flowlog.id}. Request ID: ")
136
+ expect(subject.ui).to receive(:warn).with("Deleted Flow Log #{flowlog.id}. Request ID: ")
137
137
 
138
138
  expect(subject.api_client).not_to receive(:wait_for)
139
139
  expect(subject).to receive(:get_request_id).once
@@ -171,7 +171,7 @@ describe Chef::Knife::IonoscloudFlowlogDelete do
171
171
  subject_config.each { |key, value| subject.config[key] = value }
172
172
  subject.name_args = [flowlog_id]
173
173
 
174
- expect(subject.ui).to receive(:error).with("Flow log ID #{flowlog_id} not found. Skipping.")
174
+ expect(subject.ui).to receive(:error).with("Flow Log ID #{flowlog_id} not found. Skipping.")
175
175
 
176
176
  expect(subject.api_client).not_to receive(:wait_for)
177
177
  mock_call_api(
@@ -218,7 +218,7 @@ describe Chef::Knife::IonoscloudFlowlogDelete do
218
218
  ionoscloud_password: 'password',
219
219
  datacenter_id: 'datacenter_id',
220
220
  network_loadbalancer_id: 'network_loadbalancer_id',
221
- type: 'loadbalancer',
221
+ type: 'networkloadbalancer',
222
222
  yes: true,
223
223
  }
224
224
 
@@ -230,7 +230,7 @@ describe Chef::Knife::IonoscloudFlowlogDelete do
230
230
  expect(subject).to receive(:puts).with("Action: #{flowlog.properties.action}")
231
231
  expect(subject).to receive(:puts).with("Direction: #{flowlog.properties.direction}")
232
232
  expect(subject).to receive(:puts).with("Bucket: #{flowlog.properties.bucket}")
233
- expect(subject.ui).to receive(:warn).with("Deleted flow log #{flowlog.id}. Request ID: ")
233
+ expect(subject.ui).to receive(:warn).with("Deleted Flow Log #{flowlog.id}. Request ID: ")
234
234
 
235
235
  expect(subject.api_client).not_to receive(:wait_for)
236
236
  expect(subject).to receive(:get_request_id).once
@@ -264,13 +264,13 @@ describe Chef::Knife::IonoscloudFlowlogDelete do
264
264
  ionoscloud_password: 'password',
265
265
  datacenter_id: 'datacenter_id',
266
266
  network_loadbalancer_id: 'network_loadbalancer_id',
267
- type: 'loadbalancer',
267
+ type: 'networkloadbalancer',
268
268
  }
269
269
 
270
270
  subject_config.each { |key, value| subject.config[key] = value }
271
271
  subject.name_args = [flowlog_id]
272
272
 
273
- expect(subject.ui).to receive(:error).with("Flow log ID #{flowlog_id} not found. Skipping.")
273
+ expect(subject.ui).to receive(:error).with("Flow Log ID #{flowlog_id} not found. Skipping.")
274
274
 
275
275
  expect(subject.api_client).not_to receive(:wait_for)
276
276
  mock_call_api(
@@ -296,7 +296,7 @@ describe Chef::Knife::IonoscloudFlowlogDelete do
296
296
  ionoscloud_username: 'email',
297
297
  ionoscloud_password: 'password',
298
298
  datacenter_id: 'datacenter_id',
299
- type: 'loadbalancer',
299
+ type: 'networkloadbalancer',
300
300
  }
301
301
 
302
302
  subject_config.each { |key, value| subject.config[key] = value }
@@ -330,7 +330,7 @@ describe Chef::Knife::IonoscloudFlowlogDelete do
330
330
 
331
331
  subject_config.each { |key, value| subject.config[key] = value }
332
332
 
333
- expect(subject.ui).to receive(:error).with("Flow log cannot belong to #{subject_config[:type]}. Value must be one of ['nic', 'natgateway', 'loadbalancer']")
333
+ expect(subject.ui).to receive(:error).with("Flow Log cannot belong to #{subject_config[:type]}. Value must be one of ['nic', 'natgateway', 'networkloadbalancer']")
334
334
 
335
335
  expect(subject.api_client).not_to receive(:call_api)
336
336
 
@@ -0,0 +1,171 @@
1
+ require 'spec_helper'
2
+ require 'ionoscloud_flowlog_get'
3
+
4
+ Chef::Knife::IonoscloudFlowlogGet.load_deps
5
+
6
+ describe Chef::Knife::IonoscloudFlowlogGet do
7
+ before :each do
8
+ subject { Chef::Knife::IonoscloudFlowlogGet.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 FlowLogsApi.datacenters_servers_nics_flowlogs_find_by_id' do
16
+ flowlog = flowlog_mock
17
+ subject_config = {
18
+ ionoscloud_username: 'email',
19
+ ionoscloud_password: 'password',
20
+ type: 'nic',
21
+ datacenter_id: 'datacenter_id',
22
+ server_id: 'server_id',
23
+ nic_id: 'nic_id',
24
+ flowlog_id: flowlog.id,
25
+ yes: true,
26
+ }
27
+
28
+ subject_config.each { |key, value| subject.config[key] = value }
29
+
30
+ expect(subject).to receive(:puts).with("ID: #{flowlog.id}")
31
+ expect(subject).to receive(:puts).with("Name: #{flowlog.properties.name}")
32
+ expect(subject).to receive(:puts).with("Action: #{flowlog.properties.action}")
33
+ expect(subject).to receive(:puts).with("Direction: #{flowlog.properties.direction}")
34
+ expect(subject).to receive(:puts).with("Bucket: #{flowlog.properties.bucket}")
35
+
36
+ expect(subject.api_client).not_to receive(:wait_for)
37
+ mock_call_api(
38
+ subject,
39
+ [
40
+ {
41
+ method: 'GET',
42
+ path: "/datacenters/#{subject_config[:datacenter_id]}/servers/#{subject_config[:server_id]}/"\
43
+ "nics/#{subject_config[:nic_id]}/flowlogs/#{flowlog.id}",
44
+ operation: :'FlowLogsApi.datacenters_servers_nics_flowlogs_find_by_id',
45
+ return_type: 'FlowLog',
46
+ result: flowlog,
47
+ },
48
+ ],
49
+ )
50
+
51
+ expect { subject.run }.not_to raise_error(Exception)
52
+ end
53
+
54
+ it 'should call NATGatewaysApi.datacenters_natgateways_flowlogs_find_by_flow_log_id' do
55
+ flowlog = flowlog_mock
56
+ subject_config = {
57
+ ionoscloud_username: 'email',
58
+ ionoscloud_password: 'password',
59
+ type: 'natgateway',
60
+ datacenter_id: 'datacenter_id',
61
+ natgateway_id: 'natgateway_id',
62
+ flowlog_id: flowlog.id,
63
+ yes: true,
64
+ }
65
+
66
+ subject_config.each { |key, value| subject.config[key] = value }
67
+
68
+ expect(subject).to receive(:puts).with("ID: #{flowlog.id}")
69
+ expect(subject).to receive(:puts).with("Name: #{flowlog.properties.name}")
70
+ expect(subject).to receive(:puts).with("Action: #{flowlog.properties.action}")
71
+ expect(subject).to receive(:puts).with("Direction: #{flowlog.properties.direction}")
72
+ expect(subject).to receive(:puts).with("Bucket: #{flowlog.properties.bucket}")
73
+
74
+ expect(subject.api_client).not_to receive(:wait_for)
75
+ mock_call_api(
76
+ subject,
77
+ [
78
+ {
79
+ method: 'GET',
80
+ path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{subject_config[:natgateway_id]}/flowlogs/#{flowlog.id}",
81
+ operation: :'NATGatewaysApi.datacenters_natgateways_flowlogs_find_by_flow_log_id',
82
+ return_type: 'FlowLog',
83
+ result: flowlog,
84
+ },
85
+ ],
86
+ )
87
+
88
+ expect { subject.run }.not_to raise_error(Exception)
89
+ end
90
+
91
+ it 'should call NetworkLoadBalancersApi.datacenters_networkloadbalancers_flowlogs_find_by_flow_log_id' do
92
+ flowlog = flowlog_mock
93
+ subject_config = {
94
+ ionoscloud_username: 'email',
95
+ ionoscloud_password: 'password',
96
+ type: 'networkloadbalancer',
97
+ datacenter_id: 'datacenter_id',
98
+ network_loadbalancer_id: 'network_loadbalancer_id',
99
+ flowlog_id: flowlog.id,
100
+ yes: true,
101
+ }
102
+
103
+ subject_config.each { |key, value| subject.config[key] = value }
104
+
105
+ expect(subject).to receive(:puts).with("ID: #{flowlog.id}")
106
+ expect(subject).to receive(:puts).with("Name: #{flowlog.properties.name}")
107
+ expect(subject).to receive(:puts).with("Action: #{flowlog.properties.action}")
108
+ expect(subject).to receive(:puts).with("Direction: #{flowlog.properties.direction}")
109
+ expect(subject).to receive(:puts).with("Bucket: #{flowlog.properties.bucket}")
110
+
111
+ expect(subject.api_client).not_to receive(:wait_for)
112
+ mock_call_api(
113
+ subject,
114
+ [
115
+ {
116
+ method: 'GET',
117
+ path: "/datacenters/#{subject_config[:datacenter_id]}/networkloadbalancers/#{subject_config[:network_loadbalancer_id]}/flowlogs/#{flowlog.id}",
118
+ operation: :'NetworkLoadBalancersApi.datacenters_networkloadbalancers_flowlogs_find_by_flow_log_id',
119
+ return_type: 'FlowLog',
120
+ result: flowlog,
121
+ },
122
+ ],
123
+ )
124
+
125
+ expect { subject.run }.not_to raise_error(Exception)
126
+ end
127
+
128
+ it 'should not call anything when the wrong type is given' do
129
+ flowlog = flowlog_mock
130
+ subject_config = {
131
+ ionoscloud_username: 'email',
132
+ ionoscloud_password: 'password',
133
+ datacenter_id: 'datacenter_id',
134
+ server_id: 'server_id',
135
+ natgateway_id: 'natgateway_id',
136
+ network_loadbalancer_id: 'network_loadbalancer_id',
137
+ flowlog_id: 'flowlog_id',
138
+ nic_id: 'nic_id',
139
+ type: 'other',
140
+ }
141
+
142
+ subject_config.each { |key, value| subject.config[key] = value }
143
+
144
+ expect(subject.ui).to receive(:error).with("Flow Log cannot belong to #{subject_config[:type]}. Value must be one of ['nic', 'natgateway', 'networkloadbalancer']")
145
+
146
+ expect(subject.api_client).not_to receive(:call_api)
147
+
148
+ expect { subject.run }.to raise_error(SystemExit) do |error|
149
+ expect(error.status).to eq(1)
150
+ end
151
+ end
152
+
153
+ it 'should not make any call if any required option is missing' do
154
+ required_options = subject.instance_variable_get(:@required_options)
155
+
156
+ arrays_without_one_element(required_options).each do |test_case|
157
+
158
+ test_case[:array].each { |value| subject.config[value] = 'test' }
159
+
160
+ expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
161
+ expect(subject.api_client).not_to receive(:call_api)
162
+
163
+ expect { subject.run }.to raise_error(SystemExit) do |error|
164
+ expect(error.status).to eq(1)
165
+ end
166
+
167
+ required_options.each { |value| subject.config[value] = nil }
168
+ end
169
+ end
170
+ end
171
+ end
@@ -155,7 +155,7 @@ describe Chef::Knife::IonoscloudFlowlogList do
155
155
  ionoscloud_password: 'password',
156
156
  datacenter_id: 'datacenter_id',
157
157
  network_loadbalancer_id: 'network_loadbalancer_id',
158
- type: 'loadbalancer',
158
+ type: 'networkloadbalancer',
159
159
  }
160
160
 
161
161
  subject_config.each { |key, value| subject.config[key] = value }
@@ -200,7 +200,7 @@ describe Chef::Knife::IonoscloudFlowlogList do
200
200
  ionoscloud_username: 'email',
201
201
  ionoscloud_password: 'password',
202
202
  datacenter_id: 'datacenter_id',
203
- type: 'loadbalancer',
203
+ type: 'networkloadbalancer',
204
204
  }
205
205
 
206
206
  subject_config.each { |key, value| subject.config[key] = value }
@@ -234,7 +234,7 @@ describe Chef::Knife::IonoscloudFlowlogList do
234
234
 
235
235
  subject_config.each { |key, value| subject.config[key] = value }
236
236
 
237
- expect(subject.ui).to receive(:error).with("Flow log cannot belong to #{subject_config[:type]}. Value must be one of ['nic', 'natgateway', 'loadbalancer']")
237
+ expect(subject.ui).to receive(:error).with("Flow log cannot belong to #{subject_config[:type]}. Value must be one of ['nic', 'natgateway', 'networkloadbalancer']")
238
238
 
239
239
  expect(subject.api_client).not_to receive(:call_api)
240
240
 
@@ -0,0 +1,244 @@
1
+ require 'spec_helper'
2
+ require 'ionoscloud_flowlog_update'
3
+
4
+ Chef::Knife::IonoscloudFlowlogUpdate.load_deps
5
+
6
+ describe Chef::Knife::IonoscloudFlowlogUpdate do
7
+ before :each do
8
+ subject { Chef::Knife::IonoscloudFlowlogUpdate.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 FlowLogsApi.datacenters_servers_nics_flowlogs_patch' do
16
+ flowlog = flowlog_mock
17
+ subject_config = {
18
+ ionoscloud_username: 'email',
19
+ ionoscloud_password: 'password',
20
+ type: 'nic',
21
+ datacenter_id: 'datacenter_id',
22
+ server_id: 'server_id',
23
+ nic_id: 'nic_id',
24
+ flowlog_id: flowlog.id,
25
+ name: flowlog.properties.name + '_edited',
26
+ action: 'REJECTED',
27
+ direction: 'BIDIRECTIONAL',
28
+ bucket: 'new_bucket_name',
29
+ yes: true,
30
+ }
31
+
32
+ subject_config.each { |key, value| subject.config[key] = value }
33
+
34
+ expect(subject).to receive(:puts).with("ID: #{flowlog.id}")
35
+ expect(subject).to receive(:puts).with("Name: #{subject_config[:name]}")
36
+ expect(subject).to receive(:puts).with("Action: #{subject_config[:action]}")
37
+ expect(subject).to receive(:puts).with("Direction: #{subject_config[:direction]}")
38
+ expect(subject).to receive(:puts).with("Bucket: #{subject_config[:bucket]}")
39
+
40
+ flowlog.properties.name = subject_config[:name]
41
+ flowlog.properties.action = subject_config[:action]
42
+ flowlog.properties.direction = subject_config[:direction]
43
+ flowlog.properties.bucket = subject_config[:bucket]
44
+
45
+ expected_body = {
46
+ name: subject_config[:name],
47
+ action: subject_config[:action],
48
+ direction: subject_config[:direction],
49
+ bucket: subject_config[:bucket],
50
+ }
51
+
52
+ mock_wait_for(subject)
53
+ mock_call_api(
54
+ subject,
55
+ [
56
+ {
57
+ method: 'PATCH',
58
+ path: "/datacenters/#{subject_config[:datacenter_id]}/servers/#{subject_config[:server_id]}/"\
59
+ "nics/#{subject_config[:nic_id]}/flowlogs/#{flowlog.id}",
60
+ operation: :'FlowLogsApi.datacenters_servers_nics_flowlogs_patch',
61
+ return_type: 'FlowLog',
62
+ body: expected_body,
63
+ result: flowlog,
64
+ },
65
+ {
66
+ method: 'GET',
67
+ path: "/datacenters/#{subject_config[:datacenter_id]}/servers/#{subject_config[:server_id]}/"\
68
+ "nics/#{subject_config[:nic_id]}/flowlogs/#{flowlog.id}",
69
+ operation: :'FlowLogsApi.datacenters_servers_nics_flowlogs_find_by_id',
70
+ return_type: 'FlowLog',
71
+ result: flowlog,
72
+ },
73
+ ],
74
+ )
75
+
76
+ expect { subject.run }.not_to raise_error(Exception)
77
+ end
78
+
79
+ it 'should call NATGatewaysApi.datacenters_natgateways_flowlogs_patch' do
80
+ flowlog = flowlog_mock
81
+ subject_config = {
82
+ ionoscloud_username: 'email',
83
+ ionoscloud_password: 'password',
84
+ type: 'natgateway',
85
+ datacenter_id: 'datacenter_id',
86
+ natgateway_id: 'natgateway_id',
87
+ flowlog_id: flowlog.id,
88
+ name: flowlog.properties.name + '_edited',
89
+ action: 'REJECTED',
90
+ direction: 'BIDIRECTIONAL',
91
+ bucket: 'new_bucket_name',
92
+ yes: true,
93
+ }
94
+
95
+ subject_config.each { |key, value| subject.config[key] = value }
96
+
97
+ expect(subject).to receive(:puts).with("ID: #{flowlog.id}")
98
+ expect(subject).to receive(:puts).with("Name: #{subject_config[:name]}")
99
+ expect(subject).to receive(:puts).with("Action: #{subject_config[:action]}")
100
+ expect(subject).to receive(:puts).with("Direction: #{subject_config[:direction]}")
101
+ expect(subject).to receive(:puts).with("Bucket: #{subject_config[:bucket]}")
102
+
103
+ flowlog.properties.name = subject_config[:name]
104
+ flowlog.properties.action = subject_config[:action]
105
+ flowlog.properties.direction = subject_config[:direction]
106
+ flowlog.properties.bucket = subject_config[:bucket]
107
+
108
+ expected_body = {
109
+ name: subject_config[:name],
110
+ action: subject_config[:action],
111
+ direction: subject_config[:direction],
112
+ bucket: subject_config[:bucket],
113
+ }
114
+
115
+ mock_wait_for(subject)
116
+ mock_call_api(
117
+ subject,
118
+ [
119
+ {
120
+ method: 'PATCH',
121
+ path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{subject_config[:natgateway_id]}/flowlogs/#{flowlog.id}",
122
+ operation: :'NATGatewaysApi.datacenters_natgateways_flowlogs_patch',
123
+ return_type: 'FlowLog',
124
+ body: expected_body,
125
+ result: flowlog,
126
+ },
127
+ {
128
+ method: 'GET',
129
+ path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{subject_config[:natgateway_id]}/flowlogs/#{flowlog.id}",
130
+ operation: :'NATGatewaysApi.datacenters_natgateways_flowlogs_find_by_flow_log_id',
131
+ return_type: 'FlowLog',
132
+ result: flowlog,
133
+ },
134
+ ],
135
+ )
136
+
137
+ expect { subject.run }.not_to raise_error(Exception)
138
+ end
139
+
140
+ it 'should call NetworkLoadBalancersApi.datacenters_networkloadbalancers_flowlogs_patch' do
141
+ flowlog = flowlog_mock
142
+ subject_config = {
143
+ ionoscloud_username: 'email',
144
+ ionoscloud_password: 'password',
145
+ type: 'networkloadbalancer',
146
+ datacenter_id: 'datacenter_id',
147
+ network_loadbalancer_id: 'network_loadbalancer_id',
148
+ flowlog_id: flowlog.id,
149
+ name: flowlog.properties.name + '_edited',
150
+ action: 'REJECTED',
151
+ direction: 'BIDIRECTIONAL',
152
+ bucket: 'new_bucket_name',
153
+ yes: true,
154
+ }
155
+
156
+ subject_config.each { |key, value| subject.config[key] = value }
157
+
158
+ expect(subject).to receive(:puts).with("ID: #{flowlog.id}")
159
+ expect(subject).to receive(:puts).with("Name: #{subject_config[:name]}")
160
+ expect(subject).to receive(:puts).with("Action: #{subject_config[:action]}")
161
+ expect(subject).to receive(:puts).with("Direction: #{subject_config[:direction]}")
162
+ expect(subject).to receive(:puts).with("Bucket: #{subject_config[:bucket]}")
163
+
164
+ flowlog.properties.name = subject_config[:name]
165
+ flowlog.properties.action = subject_config[:action]
166
+ flowlog.properties.direction = subject_config[:direction]
167
+ flowlog.properties.bucket = subject_config[:bucket]
168
+
169
+ expected_body = {
170
+ name: subject_config[:name],
171
+ action: subject_config[:action],
172
+ direction: subject_config[:direction],
173
+ bucket: subject_config[:bucket],
174
+ }
175
+
176
+ mock_wait_for(subject)
177
+ mock_call_api(
178
+ subject,
179
+ [
180
+ {
181
+ method: 'PATCH',
182
+ path: "/datacenters/#{subject_config[:datacenter_id]}/networkloadbalancers/#{subject_config[:network_loadbalancer_id]}/flowlogs/#{flowlog.id}",
183
+ operation: :'NetworkLoadBalancersApi.datacenters_networkloadbalancers_flowlogs_patch',
184
+ return_type: 'FlowLog',
185
+ body: expected_body,
186
+ result: flowlog,
187
+ },
188
+ {
189
+ method: 'GET',
190
+ path: "/datacenters/#{subject_config[:datacenter_id]}/networkloadbalancers/#{subject_config[:network_loadbalancer_id]}/flowlogs/#{flowlog.id}",
191
+ operation: :'NetworkLoadBalancersApi.datacenters_networkloadbalancers_flowlogs_find_by_flow_log_id',
192
+ return_type: 'FlowLog',
193
+ result: flowlog,
194
+ },
195
+ ],
196
+ )
197
+
198
+ expect { subject.run }.not_to raise_error(Exception)
199
+ end
200
+
201
+ it 'should not call anything when the wrong type is given' do
202
+ flowlog = flowlog_mock
203
+ subject_config = {
204
+ ionoscloud_username: 'email',
205
+ ionoscloud_password: 'password',
206
+ datacenter_id: 'datacenter_id',
207
+ server_id: 'server_id',
208
+ natgateway_id: 'natgateway_id',
209
+ network_loadbalancer_id: 'network_loadbalancer_id',
210
+ flowlog_id: 'flowlog_id',
211
+ nic_id: 'nic_id',
212
+ type: 'other',
213
+ }
214
+
215
+ subject_config.each { |key, value| subject.config[key] = value }
216
+
217
+ expect(subject.ui).to receive(:error).with("Flow Log cannot belong to #{subject_config[:type]}. Value must be one of ['nic', 'natgateway', 'networkloadbalancer']")
218
+
219
+ expect(subject.api_client).not_to receive(:call_api)
220
+
221
+ expect { subject.run }.to raise_error(SystemExit) do |error|
222
+ expect(error.status).to eq(1)
223
+ end
224
+ end
225
+
226
+ it 'should not make any call if any required option is missing' do
227
+ required_options = subject.instance_variable_get(:@required_options)
228
+
229
+ arrays_without_one_element(required_options).each do |test_case|
230
+
231
+ test_case[:array].each { |value| subject.config[value] = 'test' }
232
+
233
+ expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
234
+ expect(subject.api_client).not_to receive(:call_api)
235
+
236
+ expect { subject.run }.to raise_error(SystemExit) do |error|
237
+ expect(error.status).to eq(1)
238
+ end
239
+
240
+ required_options.each { |value| subject.config[value] = nil }
241
+ end
242
+ end
243
+ end
244
+ end