knife-ionoscloud 6.1.0 → 6.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (248) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build.yml +17 -0
  3. data/.rubocop.yml +72 -0
  4. data/docs/docs_generator.rb +21 -24
  5. data/docs/subcommands/dbaas-postgres/dbaas_postgres_backup_get.md +1 -1
  6. data/docs/subcommands/dbaas-postgres/dbaas_postgres_backup_list.md +1 -2
  7. data/docs/subcommands/dbaas-postgres/dbaas_postgres_cluster_create.md +6 -3
  8. data/docs/subcommands/dbaas-postgres/dbaas_postgres_cluster_delete.md +1 -1
  9. data/docs/subcommands/dbaas-postgres/dbaas_postgres_cluster_get.md +1 -1
  10. data/docs/subcommands/dbaas-postgres/dbaas_postgres_cluster_list.md +1 -1
  11. data/docs/subcommands/dbaas-postgres/dbaas_postgres_cluster_restore.md +1 -1
  12. data/docs/subcommands/dbaas-postgres/dbaas_postgres_cluster_update.md +2 -2
  13. data/docs/subcommands/dbaas-postgres/dbaas_postgres_logs_get.md +7 -4
  14. data/docs/subcommands/dbaas-postgres/dbaas_postgres_version_list.md +1 -2
  15. data/docs/subcommands/kubernetes/k8s_create.md +4 -1
  16. data/docs/subcommands/kubernetes/nodepool_create.md +4 -1
  17. data/docs/summary.md +124 -124
  18. data/knife-ionoscloud.gemspec +2 -2
  19. data/lib/chef/knife/ionoscloud_backupunit_delete.rb +1 -1
  20. data/lib/chef/knife/ionoscloud_backupunit_update.rb +1 -1
  21. data/lib/chef/knife/ionoscloud_base.rb +3 -0
  22. data/lib/chef/knife/ionoscloud_composite_server_create.rb +2 -2
  23. data/lib/chef/knife/ionoscloud_contract_list.rb +1 -2
  24. data/lib/chef/knife/ionoscloud_cube_server_create.rb +3 -3
  25. data/lib/chef/knife/ionoscloud_datacenter_create.rb +2 -2
  26. data/lib/chef/knife/ionoscloud_datacenter_delete.rb +1 -1
  27. data/lib/chef/knife/ionoscloud_datacenter_update.rb +2 -2
  28. data/lib/chef/knife/ionoscloud_dbaas_postgres_backup_get.rb +2 -2
  29. data/lib/chef/knife/ionoscloud_dbaas_postgres_backup_list.rb +2 -2
  30. data/lib/chef/knife/ionoscloud_dbaas_postgres_cluster_create.rb +11 -7
  31. data/lib/chef/knife/ionoscloud_dbaas_postgres_cluster_delete.rb +2 -2
  32. data/lib/chef/knife/ionoscloud_dbaas_postgres_cluster_get.rb +3 -3
  33. data/lib/chef/knife/ionoscloud_dbaas_postgres_cluster_list.rb +3 -1
  34. data/lib/chef/knife/ionoscloud_dbaas_postgres_cluster_update.rb +2 -4
  35. data/lib/chef/knife/ionoscloud_dbaas_postgres_logs_get.rb +37 -6
  36. data/lib/chef/knife/ionoscloud_dbaas_postgres_version_list.rb +3 -2
  37. data/lib/chef/knife/ionoscloud_firewall_create.rb +1 -1
  38. data/lib/chef/knife/ionoscloud_firewall_delete.rb +1 -1
  39. data/lib/chef/knife/ionoscloud_firewall_list.rb +1 -1
  40. data/lib/chef/knife/ionoscloud_flowlog_delete.rb +1 -3
  41. data/lib/chef/knife/ionoscloud_flowlog_list.rb +3 -5
  42. data/lib/chef/knife/ionoscloud_group_delete.rb +1 -1
  43. data/lib/chef/knife/ionoscloud_group_update.rb +1 -1
  44. data/lib/chef/knife/ionoscloud_ipblock_delete.rb +1 -1
  45. data/lib/chef/knife/ionoscloud_k8s_create.rb +6 -0
  46. data/lib/chef/knife/ionoscloud_k8s_delete.rb +2 -2
  47. data/lib/chef/knife/ionoscloud_k8s_list.rb +3 -1
  48. data/lib/chef/knife/ionoscloud_k8s_update.rb +2 -6
  49. data/lib/chef/knife/ionoscloud_label_list.rb +1 -3
  50. data/lib/chef/knife/ionoscloud_lan_delete.rb +1 -1
  51. data/lib/chef/knife/ionoscloud_loadbalancer_delete.rb +1 -1
  52. data/lib/chef/knife/ionoscloud_natgateway_create.rb +1 -1
  53. data/lib/chef/knife/ionoscloud_natgateway_delete.rb +1 -1
  54. data/lib/chef/knife/ionoscloud_natgateway_rule_add.rb +1 -1
  55. data/lib/chef/knife/ionoscloud_natgateway_rule_update.rb +1 -1
  56. data/lib/chef/knife/ionoscloud_natgateway_update.rb +1 -2
  57. data/lib/chef/knife/ionoscloud_networkloadbalancer_delete.rb +1 -1
  58. data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_add.rb +1 -2
  59. data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_target_remove.rb +1 -2
  60. data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_update.rb +1 -2
  61. data/lib/chef/knife/ionoscloud_nic_create.rb +3 -3
  62. data/lib/chef/knife/ionoscloud_nic_delete.rb +1 -1
  63. data/lib/chef/knife/ionoscloud_node_delete.rb +1 -1
  64. data/lib/chef/knife/ionoscloud_node_replace.rb +3 -3
  65. data/lib/chef/knife/ionoscloud_nodepool_create.rb +7 -2
  66. data/lib/chef/knife/ionoscloud_nodepool_delete.rb +1 -1
  67. data/lib/chef/knife/ionoscloud_nodepool_list.rb +3 -1
  68. data/lib/chef/knife/ionoscloud_pcc_delete.rb +1 -1
  69. data/lib/chef/knife/ionoscloud_pcc_update.rb +1 -1
  70. data/lib/chef/knife/ionoscloud_request_list.rb +6 -18
  71. data/lib/chef/knife/ionoscloud_resource_list.rb +10 -12
  72. data/lib/chef/knife/ionoscloud_s3key_delete.rb +1 -1
  73. data/lib/chef/knife/ionoscloud_server_create.rb +3 -3
  74. data/lib/chef/knife/ionoscloud_server_delete.rb +3 -3
  75. data/lib/chef/knife/ionoscloud_server_upgrade.rb +1 -1
  76. data/lib/chef/knife/ionoscloud_share_delete.rb +1 -1
  77. data/lib/chef/knife/ionoscloud_snapshot_delete.rb +1 -1
  78. data/lib/chef/knife/ionoscloud_snapshot_list.rb +1 -1
  79. data/lib/chef/knife/ionoscloud_user_delete.rb +1 -1
  80. data/lib/chef/knife/ionoscloud_volume_delete.rb +1 -1
  81. data/lib/chef/knife/ionoscloud_volume_detach.rb +4 -4
  82. data/lib/knife-ionoscloud/version.rb +1 -1
  83. data/sonar-project.properties +3 -0
  84. data/spec/chef/knife/ionoscloud_backupunit_create_spec.rb +1 -2
  85. data/spec/chef/knife/ionoscloud_backupunit_delete_spec.rb +0 -1
  86. data/spec/chef/knife/ionoscloud_backupunit_get_spec.rb +0 -1
  87. data/spec/chef/knife/ionoscloud_backupunit_list_spec.rb +0 -1
  88. data/spec/chef/knife/ionoscloud_backupunit_ssourl_spec.rb +2 -4
  89. data/spec/chef/knife/ionoscloud_backupunit_update_spec.rb +0 -1
  90. data/spec/chef/knife/ionoscloud_base_spec.rb +3 -4
  91. data/spec/chef/knife/ionoscloud_composite_server_create_spec.rb +0 -1
  92. data/spec/chef/knife/ionoscloud_contract_list_spec.rb +0 -1
  93. data/spec/chef/knife/ionoscloud_cube_server_create_spec.rb +2 -3
  94. data/spec/chef/knife/ionoscloud_datacenter_create_spec.rb +0 -1
  95. data/spec/chef/knife/ionoscloud_datacenter_delete_spec.rb +0 -1
  96. data/spec/chef/knife/ionoscloud_datacenter_get_spec.rb +0 -1
  97. data/spec/chef/knife/ionoscloud_datacenter_list_spec.rb +0 -1
  98. data/spec/chef/knife/ionoscloud_datacenter_update_spec.rb +0 -1
  99. data/spec/chef/knife/ionoscloud_dbaas_postgres_backup_get_spec.rb +0 -1
  100. data/spec/chef/knife/ionoscloud_dbaas_postgres_backup_list_spec.rb +1 -2
  101. data/spec/chef/knife/ionoscloud_dbaas_postgres_cluster_create_spec.rb +4 -3
  102. data/spec/chef/knife/ionoscloud_dbaas_postgres_cluster_delete_spec.rb +1 -1
  103. data/spec/chef/knife/ionoscloud_dbaas_postgres_cluster_get_spec.rb +1 -1
  104. data/spec/chef/knife/ionoscloud_dbaas_postgres_cluster_list_spec.rb +3 -2
  105. data/spec/chef/knife/ionoscloud_dbaas_postgres_cluster_restore_spec.rb +0 -1
  106. data/spec/chef/knife/ionoscloud_dbaas_postgres_cluster_update_spec.rb +1 -1
  107. data/spec/chef/knife/ionoscloud_dbaas_postgres_logs_get_spec.rb +75 -4
  108. data/spec/chef/knife/ionoscloud_dbaas_postgres_version_list_spec.rb +2 -3
  109. data/spec/chef/knife/ionoscloud_firewall_create_spec.rb +0 -1
  110. data/spec/chef/knife/ionoscloud_firewall_delete_spec.rb +0 -1
  111. data/spec/chef/knife/ionoscloud_firewall_get_spec.rb +0 -1
  112. data/spec/chef/knife/ionoscloud_firewall_list_spec.rb +0 -1
  113. data/spec/chef/knife/ionoscloud_firewall_update_spec.rb +2 -3
  114. data/spec/chef/knife/ionoscloud_flowlog_create_spec.rb +0 -1
  115. data/spec/chef/knife/ionoscloud_flowlog_delete_spec.rb +0 -1
  116. data/spec/chef/knife/ionoscloud_flowlog_get_spec.rb +0 -2
  117. data/spec/chef/knife/ionoscloud_flowlog_list_spec.rb +0 -1
  118. data/spec/chef/knife/ionoscloud_flowlog_update_spec.rb +0 -2
  119. data/spec/chef/knife/ionoscloud_group_create_spec.rb +0 -1
  120. data/spec/chef/knife/ionoscloud_group_delete_spec.rb +0 -1
  121. data/spec/chef/knife/ionoscloud_group_get_spec.rb +0 -1
  122. data/spec/chef/knife/ionoscloud_group_list_spec.rb +2 -3
  123. data/spec/chef/knife/ionoscloud_group_update_spec.rb +0 -1
  124. data/spec/chef/knife/ionoscloud_group_user_add_spec.rb +0 -1
  125. data/spec/chef/knife/ionoscloud_group_user_remove_spec.rb +0 -1
  126. data/spec/chef/knife/ionoscloud_image_list_spec.rb +0 -1
  127. data/spec/chef/knife/ionoscloud_ipblock_create_spec.rb +0 -1
  128. data/spec/chef/knife/ionoscloud_ipblock_delete_spec.rb +0 -1
  129. data/spec/chef/knife/ionoscloud_ipblock_get_spec.rb +0 -1
  130. data/spec/chef/knife/ionoscloud_ipblock_list_spec.rb +0 -1
  131. data/spec/chef/knife/ionoscloud_ipblock_update_spec.rb +0 -1
  132. data/spec/chef/knife/ionoscloud_ipfailover_add_spec.rb +0 -1
  133. data/spec/chef/knife/ionoscloud_ipfailover_remove_spec.rb +0 -1
  134. data/spec/chef/knife/ionoscloud_k8s_create_spec.rb +1 -1
  135. data/spec/chef/knife/ionoscloud_k8s_delete_spec.rb +4 -4
  136. data/spec/chef/knife/ionoscloud_k8s_get_spec.rb +1 -1
  137. data/spec/chef/knife/ionoscloud_k8s_list_spec.rb +3 -2
  138. data/spec/chef/knife/ionoscloud_k8s_update_spec.rb +3 -3
  139. data/spec/chef/knife/ionoscloud_kubeconfig_get_spec.rb +2 -4
  140. data/spec/chef/knife/ionoscloud_label_add_spec.rb +1 -2
  141. data/spec/chef/knife/ionoscloud_label_list_spec.rb +4 -5
  142. data/spec/chef/knife/ionoscloud_label_remove_spec.rb +1 -2
  143. data/spec/chef/knife/ionoscloud_lan_create_spec.rb +0 -1
  144. data/spec/chef/knife/ionoscloud_lan_delete_spec.rb +0 -1
  145. data/spec/chef/knife/ionoscloud_lan_get_spec.rb +0 -1
  146. data/spec/chef/knife/ionoscloud_lan_list_spec.rb +0 -1
  147. data/spec/chef/knife/ionoscloud_lan_update_spec.rb +0 -1
  148. data/spec/chef/knife/ionoscloud_loadbalancer_create_spec.rb +0 -1
  149. data/spec/chef/knife/ionoscloud_loadbalancer_delete_spec.rb +0 -1
  150. data/spec/chef/knife/ionoscloud_loadbalancer_get_spec.rb +0 -1
  151. data/spec/chef/knife/ionoscloud_loadbalancer_list_spec.rb +0 -1
  152. data/spec/chef/knife/ionoscloud_loadbalancer_nic_add_spec.rb +0 -1
  153. data/spec/chef/knife/ionoscloud_loadbalancer_nic_remove_spec.rb +0 -1
  154. data/spec/chef/knife/ionoscloud_loadbalancer_update_spec.rb +1 -2
  155. data/spec/chef/knife/ionoscloud_location_list_spec.rb +1 -2
  156. data/spec/chef/knife/ionoscloud_natgateway_create_spec.rb +0 -1
  157. data/spec/chef/knife/ionoscloud_natgateway_delete_spec.rb +0 -1
  158. data/spec/chef/knife/ionoscloud_natgateway_get_spec.rb +0 -1
  159. data/spec/chef/knife/ionoscloud_natgateway_lan_add_spec.rb +2 -3
  160. data/spec/chef/knife/ionoscloud_natgateway_lan_remove_spec.rb +0 -1
  161. data/spec/chef/knife/ionoscloud_natgateway_list_spec.rb +0 -1
  162. data/spec/chef/knife/ionoscloud_natgateway_rule_add_spec.rb +0 -1
  163. data/spec/chef/knife/ionoscloud_natgateway_rule_list_spec.rb +0 -1
  164. data/spec/chef/knife/ionoscloud_natgateway_rule_remove_spec.rb +0 -1
  165. data/spec/chef/knife/ionoscloud_natgateway_rule_update_spec.rb +4 -5
  166. data/spec/chef/knife/ionoscloud_natgateway_update_spec.rb +4 -6
  167. data/spec/chef/knife/ionoscloud_networkloadbalancer_create_spec.rb +0 -1
  168. data/spec/chef/knife/ionoscloud_networkloadbalancer_delete_spec.rb +0 -1
  169. data/spec/chef/knife/ionoscloud_networkloadbalancer_get_spec.rb +0 -1
  170. data/spec/chef/knife/ionoscloud_networkloadbalancer_list_spec.rb +0 -1
  171. data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_add_spec.rb +0 -1
  172. data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_list_spec.rb +0 -1
  173. data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_remove_spec.rb +0 -1
  174. data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_target_add_spec.rb +1 -2
  175. data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_target_list_spec.rb +0 -1
  176. data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_target_remove_spec.rb +12 -15
  177. data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_update_spec.rb +4 -6
  178. data/spec/chef/knife/ionoscloud_networkloadbalancer_update_spec.rb +2 -3
  179. data/spec/chef/knife/ionoscloud_nic_create_spec.rb +0 -1
  180. data/spec/chef/knife/ionoscloud_nic_delete_spec.rb +0 -1
  181. data/spec/chef/knife/ionoscloud_nic_get_spec.rb +0 -1
  182. data/spec/chef/knife/ionoscloud_nic_list_spec.rb +0 -1
  183. data/spec/chef/knife/ionoscloud_nic_update_spec.rb +1 -2
  184. data/spec/chef/knife/ionoscloud_node_delete_spec.rb +0 -1
  185. data/spec/chef/knife/ionoscloud_node_get_spec.rb +0 -1
  186. data/spec/chef/knife/ionoscloud_node_list_spec.rb +0 -1
  187. data/spec/chef/knife/ionoscloud_node_replace_spec.rb +0 -1
  188. data/spec/chef/knife/ionoscloud_nodepool_create_spec.rb +2 -1
  189. data/spec/chef/knife/ionoscloud_nodepool_delete_spec.rb +2 -1
  190. data/spec/chef/knife/ionoscloud_nodepool_get_spec.rb +1 -1
  191. data/spec/chef/knife/ionoscloud_nodepool_lan_add_spec.rb +3 -3
  192. data/spec/chef/knife/{ionoscloud_nodepool_lan_remove.rb → ionoscloud_nodepool_lan_remove_spec.rb} +14 -17
  193. data/spec/chef/knife/ionoscloud_nodepool_list_spec.rb +3 -2
  194. data/spec/chef/knife/ionoscloud_nodepool_update_spec.rb +3 -3
  195. data/spec/chef/knife/ionoscloud_pcc_create_spec.rb +0 -1
  196. data/spec/chef/knife/ionoscloud_pcc_delete_spec.rb +0 -1
  197. data/spec/chef/knife/ionoscloud_pcc_get_spec.rb +0 -1
  198. data/spec/chef/knife/ionoscloud_pcc_list_spec.rb +0 -1
  199. data/spec/chef/knife/ionoscloud_pcc_update_spec.rb +0 -1
  200. data/spec/chef/knife/ionoscloud_request_get_spec.rb +0 -1
  201. data/spec/chef/knife/ionoscloud_request_list_spec.rb +1 -3
  202. data/spec/chef/knife/ionoscloud_request_status_spec.rb +2 -4
  203. data/spec/chef/knife/ionoscloud_request_wait_spec.rb +2 -5
  204. data/spec/chef/knife/ionoscloud_resource_list_spec.rb +1 -3
  205. data/spec/chef/knife/ionoscloud_s3key_create_spec.rb +0 -1
  206. data/spec/chef/knife/ionoscloud_s3key_delete_spec.rb +0 -1
  207. data/spec/chef/knife/ionoscloud_s3key_get_spec.rb +0 -1
  208. data/spec/chef/knife/ionoscloud_s3key_list_spec.rb +0 -1
  209. data/spec/chef/knife/ionoscloud_server_console_spec.rb +2 -4
  210. data/spec/chef/knife/ionoscloud_server_create_spec.rb +0 -1
  211. data/spec/chef/knife/ionoscloud_server_delete_spec.rb +0 -1
  212. data/spec/chef/knife/ionoscloud_server_get_spec.rb +0 -1
  213. data/spec/chef/knife/ionoscloud_server_list_spec.rb +0 -1
  214. data/spec/chef/knife/ionoscloud_server_reboot_spec.rb +0 -1
  215. data/spec/chef/knife/ionoscloud_server_resume_spec.rb +0 -1
  216. data/spec/chef/knife/ionoscloud_server_start_spec.rb +0 -1
  217. data/spec/chef/knife/ionoscloud_server_stop_spec.rb +0 -1
  218. data/spec/chef/knife/ionoscloud_server_suspend_spec.rb +0 -1
  219. data/spec/chef/knife/ionoscloud_server_token_spec.rb +2 -4
  220. data/spec/chef/knife/ionoscloud_server_update_spec.rb +0 -1
  221. data/spec/chef/knife/ionoscloud_server_upgrade_spec.rb +0 -1
  222. data/spec/chef/knife/ionoscloud_share_create_spec.rb +0 -1
  223. data/spec/chef/knife/ionoscloud_share_delete_spec.rb +0 -1
  224. data/spec/chef/knife/ionoscloud_share_get_spec.rb +0 -1
  225. data/spec/chef/knife/ionoscloud_share_list_spec.rb +0 -1
  226. data/spec/chef/knife/ionoscloud_share_update_spec.rb +0 -1
  227. data/spec/chef/knife/ionoscloud_snapshot_create_spec.rb +0 -1
  228. data/spec/chef/knife/ionoscloud_snapshot_delete_spec.rb +0 -1
  229. data/spec/chef/knife/ionoscloud_snapshot_get_spec.rb +0 -1
  230. data/spec/chef/knife/ionoscloud_snapshot_list_spec.rb +0 -1
  231. data/spec/chef/knife/ionoscloud_snapshot_restore_spec.rb +0 -1
  232. data/spec/chef/knife/ionoscloud_snapshot_update_spec.rb +0 -1
  233. data/spec/chef/knife/ionoscloud_template_list_spec.rb +0 -1
  234. data/spec/chef/knife/ionoscloud_user_create_spec.rb +0 -1
  235. data/spec/chef/knife/ionoscloud_user_delete_spec.rb +0 -1
  236. data/spec/chef/knife/ionoscloud_user_get_spec.rb +0 -1
  237. data/spec/chef/knife/ionoscloud_user_list_spec.rb +2 -3
  238. data/spec/chef/knife/ionoscloud_user_ssourl_spec.rb +2 -4
  239. data/spec/chef/knife/ionoscloud_user_update_spec.rb +0 -1
  240. data/spec/chef/knife/ionoscloud_volume_attach_spec.rb +0 -1
  241. data/spec/chef/knife/ionoscloud_volume_create_spec.rb +0 -1
  242. data/spec/chef/knife/ionoscloud_volume_delete_spec.rb +0 -1
  243. data/spec/chef/knife/ionoscloud_volume_detach_spec.rb +0 -1
  244. data/spec/chef/knife/ionoscloud_volume_get_spec.rb +0 -1
  245. data/spec/chef/knife/ionoscloud_volume_list_spec.rb +2 -3
  246. data/spec/chef/knife/ionoscloud_volume_update_spec.rb +0 -1
  247. data/spec/spec_helper.rb +10 -7
  248. metadata +12 -12
@@ -41,7 +41,7 @@ class Chef
41
41
 
42
42
  begin
43
43
  confirm('Do you really want to delete this S3 key')
44
- rescue SystemExit => exc
44
+ rescue SystemExit
45
45
  next
46
46
  end
47
47
 
@@ -48,10 +48,10 @@ class Chef
48
48
  def initialize(args = [])
49
49
  super(args)
50
50
  @description =
51
- "One of the unique features of the Ionoscloud platform when compared "\
52
- "with the other providers is that they allow you to define your own settings "\
51
+ 'One of the unique features of the Ionoscloud platform when compared '\
52
+ 'with the other providers is that they allow you to define your own settings '\
53
53
  "for cores, memory, and disk size without being tied to a particular size or flavor.\n\n"\
54
- "Note: _The memory parameter value must be a multiple of 256, e.g. 256, 512, 768, 1024, and so forth._"
54
+ 'Note: _The memory parameter value must be a multiple of 256, e.g. 256, 512, 768, 1024, and so forth._'
55
55
  @directory = 'compute-engine'
56
56
  @required_options = [:datacenter_id, :cores, :ram, :ionoscloud_username, :ionoscloud_password]
57
57
  end
@@ -16,8 +16,8 @@ class Chef
16
16
  super(args)
17
17
  @description =
18
18
  "This will remove a server from a VDC.\n\n"\
19
- "**NOTE**: This will not automatically remove the storage volume\\(s\\) "\
20
- "attached to a server. A separate API call is required to perform that action."
19
+ '**NOTE**: This will not automatically remove the storage volume\\(s\\) '\
20
+ 'attached to a server. A separate API call is required to perform that action.'
21
21
  @directory = 'compute-engine'
22
22
  @required_options = [:datacenter_id, :ionoscloud_username, :ionoscloud_password]
23
23
  end
@@ -43,7 +43,7 @@ class Chef
43
43
 
44
44
  begin
45
45
  confirm('Do you really want to delete this server')
46
- rescue SystemExit => exc
46
+ rescue SystemExit
47
47
  next
48
48
  end
49
49
 
@@ -20,7 +20,7 @@ class Chef
20
20
  def initialize(args = [])
21
21
  super(args)
22
22
  @description =
23
- "This will upgrade the version of the server, if needed. To verify if there is an upgrade available for a server, "\
23
+ 'This will upgrade the version of the server, if needed. To verify if there is an upgrade available for a server, '\
24
24
  "call '/datacenters/{datacenterId}/servers?upgradeNeeded=true'."
25
25
  @directory = 'compute-engine'
26
26
  @required_options = [:datacenter_id, :server_id, :ionoscloud_username, :ionoscloud_password]
@@ -41,7 +41,7 @@ class Chef
41
41
 
42
42
  begin
43
43
  confirm('Do you really want to delete this Resource Share')
44
- rescue SystemExit => exc
44
+ rescue SystemExit
45
45
  next
46
46
  end
47
47
 
@@ -36,7 +36,7 @@ class Chef
36
36
 
37
37
  begin
38
38
  confirm('Do you really want to delete this Snapshot')
39
- rescue SystemExit => exc
39
+ rescue SystemExit
40
40
  next
41
41
  end
42
42
 
@@ -25,7 +25,7 @@ class Chef
25
25
  ui.color('Name', :bold),
26
26
  ui.color('Description', :bold),
27
27
  ui.color('Location', :bold),
28
- ui.color('Size', :bold)
28
+ ui.color('Size', :bold),
29
29
  ]
30
30
 
31
31
  snapshot_api = Ionoscloud::SnapshotsApi.new(api_client)
@@ -38,7 +38,7 @@ class Chef
38
38
 
39
39
  begin
40
40
  confirm('Do you really want to delete this User')
41
- rescue SystemExit => exc
41
+ rescue SystemExit
42
42
  next
43
43
  end
44
44
 
@@ -45,7 +45,7 @@ class Chef
45
45
 
46
46
  begin
47
47
  confirm('Do you really want to delete this volume')
48
- rescue SystemExit => exc
48
+ rescue SystemExit
49
49
  next
50
50
  end
51
51
 
@@ -20,10 +20,10 @@ class Chef
20
20
  def initialize(args = [])
21
21
  super(args)
22
22
  @description =
23
- "This will detach the volume from the server. Depending on the volume "\
23
+ 'This will detach the volume from the server. Depending on the volume '\
24
24
  "HotUnplug settings, this may result in the server being rebooted.\n\n"\
25
- "This will NOT delete the volume from your virtual data center. You will "\
26
- "need to make a separate request to delete a volume."
25
+ 'This will NOT delete the volume from your virtual data center. You will '\
26
+ 'need to make a separate request to delete a volume.'
27
27
  @directory = 'compute-engine'
28
28
  @required_options = [:datacenter_id, :server_id, :ionoscloud_username, :ionoscloud_password]
29
29
  end
@@ -59,7 +59,7 @@ class Chef
59
59
 
60
60
  begin
61
61
  confirm('Do you really want to detach this volume')
62
- rescue SystemExit => exc
62
+ rescue SystemExit
63
63
  next
64
64
  end
65
65
 
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Ionoscloud
3
- VERSION = '6.1.0'
3
+ VERSION = '6.1.1'
4
4
  MAJOR, MINOR, TINY = VERSION.split('.')
5
5
  end
6
6
  end
@@ -1,6 +1,9 @@
1
1
  sonar.projectKey=knife-plugin
2
2
  sonar.organization=ionos-cloud
3
3
 
4
+ sonar.ruby.coverage.reportPaths=coverage/coverage.json
5
+ sonar.cpd.exclusions=spec/chef/knife/*.rb
6
+
4
7
  # This is the name and version displayed in the SonarCloud UI.
5
8
  #sonar.projectName=knife-plugin
6
9
  #sonar.projectVersion=1.0
@@ -14,7 +14,7 @@ describe Chef::Knife::IonoscloudBackupunitCreate do
14
14
  describe '#run' do
15
15
  it 'should call BackupUnitsApi.backupunits_post with the expected arguments and output based on what it receives' do
16
16
  backupunit = backupunit_mock
17
- subject_config = {
17
+ {
18
18
  ionoscloud_username: 'email',
19
19
  ionoscloud_password: 'password',
20
20
  name: backupunit.properties.name,
@@ -48,7 +48,6 @@ describe Chef::Knife::IonoscloudBackupunitCreate do
48
48
  required_options = subject.instance_variable_get(:@required_options)
49
49
 
50
50
  arrays_without_one_element(required_options).each do |test_case|
51
-
52
51
  test_case[:array].each { |value| subject.config[value] = 'test' }
53
52
 
54
53
  expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
@@ -84,7 +84,6 @@ describe Chef::Knife::IonoscloudBackupunitDelete do
84
84
  required_options = subject.instance_variable_get(:@required_options)
85
85
 
86
86
  arrays_without_one_element(required_options).each do |test_case|
87
-
88
87
  test_case[:array].each { |value| subject.config[value] = 'test' }
89
88
 
90
89
  expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
@@ -48,7 +48,6 @@ describe Chef::Knife::IonoscloudBackupunitGet do
48
48
  required_options = subject.instance_variable_get(:@required_options)
49
49
 
50
50
  arrays_without_one_element(required_options).each do |test_case|
51
-
52
51
  test_case[:array].each { |value| subject.config[value] = 'test' }
53
52
 
54
53
  expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
@@ -55,7 +55,6 @@ describe Chef::Knife::IonoscloudBackupunitList do
55
55
  required_options = subject.instance_variable_get(:@required_options)
56
56
 
57
57
  arrays_without_one_element(required_options).each do |test_case|
58
-
59
58
  test_case[:array].each { |value| subject.config[value] = 'test' }
60
59
 
61
60
  expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
@@ -74,9 +74,7 @@ describe Chef::Knife::IonoscloudBackupunitSsourl do
74
74
  allow(subject).to receive(:puts)
75
75
  allow(subject).to receive(:print)
76
76
 
77
- arrays_without_one_element(required_options).each {
78
- |test_case|
79
-
77
+ arrays_without_one_element(required_options).each do |test_case|
80
78
  test_case[:array].each { |value| subject.config[value] = 'test' }
81
79
 
82
80
  expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
@@ -87,7 +85,7 @@ describe Chef::Knife::IonoscloudBackupunitSsourl do
87
85
  end
88
86
 
89
87
  required_options.each { |value| subject.config[value] = nil }
90
- }
88
+ end
91
89
  end
92
90
  end
93
91
  end
@@ -61,7 +61,6 @@ describe Chef::Knife::IonoscloudBackupunitUpdate do
61
61
  required_options = subject.instance_variable_get(:@required_options)
62
62
 
63
63
  arrays_without_one_element(required_options).each do |test_case|
64
-
65
64
  test_case[:array].each { |value| subject.config[value] = 'test' }
66
65
 
67
66
  expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
@@ -99,14 +99,13 @@ describe Chef::Knife::IonoscloudBaseTest do
99
99
  expect { subject.is_done? request_id }.to raise_error(SystemExit) do |error|
100
100
  expect(error.status).to eq(1)
101
101
  end
102
-
103
102
  end
104
103
  end
105
104
 
106
105
  describe '#get_request_id' do
107
106
  it 'should return nil when Headers has no Location key' do
108
107
  headers = {
109
- 'another_key' => '/requests/123'
108
+ 'another_key' => '/requests/123',
110
109
  }
111
110
 
112
111
  expect(subject.get_request_id headers).to be_nil
@@ -114,7 +113,7 @@ describe Chef::Knife::IonoscloudBaseTest do
114
113
 
115
114
  it 'should return nil when Headers[\'Location\'] contains no uuid' do
116
115
  headers = {
117
- 'Location' => '/requests/123'
116
+ 'Location' => '/requests/123',
118
117
  }
119
118
 
120
119
  expect(subject.get_request_id headers).to be_nil
@@ -123,7 +122,7 @@ describe Chef::Knife::IonoscloudBaseTest do
123
122
  it 'should extract the ID from the headers' do
124
123
  request_id = SecureRandom.uuid
125
124
  headers = {
126
- 'Location' => "/requests/#{request_id}"
125
+ 'Location' => "/requests/#{request_id}",
127
126
  }
128
127
 
129
128
  expect(subject.get_request_id headers).to eql(request_id)
@@ -97,7 +97,6 @@ describe Chef::Knife::IonoscloudCompositeServerCreate do
97
97
  required_options = subject.instance_variable_get(:@required_options)
98
98
 
99
99
  arrays_without_one_element(required_options).each do |test_case|
100
-
101
100
  test_case[:array].each { |value| subject.config[value] = 'test' }
102
101
 
103
102
  expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
@@ -69,7 +69,6 @@ describe Chef::Knife::IonoscloudContractList do
69
69
  required_options = subject.instance_variable_get(:@required_options)
70
70
 
71
71
  arrays_without_one_element(required_options).each do |test_case|
72
-
73
72
  test_case[:array].each { |value| subject.config[value] = 'test' }
74
73
 
75
74
  expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
@@ -60,7 +60,7 @@ describe Chef::Knife::IonoscloudCubeServerCreate do
60
60
  expect(subject).to receive(:puts).with("Ram: #{server.properties.ram}")
61
61
  expect(subject).to receive(:puts).with("Availability Zone: #{server.properties.availability_zone}")
62
62
  expect(subject).to receive(:puts).with("Boot Volume: #{server.entities.volumes.items.first.id}")
63
- expect(subject).to receive(:puts).with("Boot CDROM: ")
63
+ expect(subject).to receive(:puts).with('Boot CDROM: ')
64
64
 
65
65
  expected_properties = server.properties.to_hash
66
66
  expected_properties.delete(:bootCdrom)
@@ -176,7 +176,7 @@ describe Chef::Knife::IonoscloudCubeServerCreate do
176
176
  expect(subject).to receive(:puts).with("Ram: #{server.properties.ram}")
177
177
  expect(subject).to receive(:puts).with("Availability Zone: #{server.properties.availability_zone}")
178
178
  expect(subject).to receive(:puts).with("Boot Volume: #{server.entities.volumes.items.first.id}")
179
- expect(subject).to receive(:puts).with("Boot CDROM: ")
179
+ expect(subject).to receive(:puts).with('Boot CDROM: ')
180
180
 
181
181
  expected_properties = server.properties.to_hash
182
182
  expected_properties.delete(:bootCdrom)
@@ -232,7 +232,6 @@ describe Chef::Knife::IonoscloudCubeServerCreate do
232
232
  required_options = subject.instance_variable_get(:@required_options)
233
233
 
234
234
  arrays_without_one_element(required_options).each do |test_case|
235
-
236
235
  test_case[:array].each { |value| subject.config[value] = 'test' }
237
236
 
238
237
  expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
@@ -59,7 +59,6 @@ describe Chef::Knife::IonoscloudDatacenterCreate do
59
59
  required_options = subject.instance_variable_get(:@required_options)
60
60
 
61
61
  arrays_without_one_element(required_options).each do |test_case|
62
-
63
62
  test_case[:array].each { |value| subject.config[value] = 'test' }
64
63
 
65
64
  expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
@@ -88,7 +88,6 @@ describe Chef::Knife::IonoscloudDatacenterDelete do
88
88
  required_options = subject.instance_variable_get(:@required_options)
89
89
 
90
90
  arrays_without_one_element(required_options).each do |test_case|
91
-
92
91
  test_case[:array].each { |value| subject.config[value] = 'test' }
93
92
 
94
93
  expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
@@ -52,7 +52,6 @@ describe Chef::Knife::IonoscloudDatacenterGet do
52
52
  required_options = subject.instance_variable_get(:@required_options)
53
53
 
54
54
  arrays_without_one_element(required_options).each do |test_case|
55
-
56
55
  test_case[:array].each { |value| subject.config[value] = 'test' }
57
56
 
58
57
  expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
@@ -61,7 +61,6 @@ describe Chef::Knife::IonoscloudDatacenterList do
61
61
  required_options = subject.instance_variable_get(:@required_options)
62
62
 
63
63
  arrays_without_one_element(required_options).each do |test_case|
64
-
65
64
  test_case[:array].each { |value| subject.config[value] = 'test' }
66
65
 
67
66
  expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
@@ -65,7 +65,6 @@ describe Chef::Knife::IonoscloudDatacenterUpdate do
65
65
  required_options = subject.instance_variable_get(:@required_options)
66
66
 
67
67
  arrays_without_one_element(required_options).each do |test_case|
68
-
69
68
  test_case[:array].each { |value| subject.config[value] = 'test' }
70
69
 
71
70
  expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
@@ -50,7 +50,6 @@ describe Chef::Knife::IonoscloudDbaasPostgresBackupGet do
50
50
  required_options = subject.instance_variable_get(:@required_options)
51
51
 
52
52
  arrays_without_one_element(required_options).each do |test_case|
53
-
54
53
  test_case[:array].each { |value| subject.config[value] = 'test' }
55
54
 
56
55
  expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
@@ -67,7 +67,7 @@ describe Chef::Knife::IonoscloudDbaasPostgresBackupList do
67
67
  subject_config = {
68
68
  ionoscloud_username: 'email',
69
69
  ionoscloud_password: 'password',
70
- cluster_id: 'cluster_id'
70
+ cluster_id: 'cluster_id',
71
71
  }
72
72
 
73
73
  subject_config.each { |key, value| subject.config[key] = value }
@@ -94,7 +94,6 @@ describe Chef::Knife::IonoscloudDbaasPostgresBackupList do
94
94
  required_options = subject.instance_variable_get(:@required_options)
95
95
 
96
96
  arrays_without_one_element(required_options).each do |test_case|
97
-
98
97
  test_case[:array].each { |value| subject.config[value] = 'test' }
99
98
 
100
99
  expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
@@ -21,6 +21,7 @@ describe Chef::Knife::IonoscloudDbaasPostgresClusterCreate do
21
21
  display_name: cluster.properties.display_name,
22
22
  postgres_version: cluster.properties.postgres_version,
23
23
  location: cluster.properties.location,
24
+ backup_location: cluster.properties.backup_location,
24
25
  instances: cluster.properties.instances,
25
26
  ram: cluster.properties.ram,
26
27
  cores: cluster.properties.cores,
@@ -37,8 +38,8 @@ describe Chef::Knife::IonoscloudDbaasPostgresClusterCreate do
37
38
  day_of_the_week: cluster.properties.maintenance_window.day_of_the_week,
38
39
  synchronization_mode: cluster.properties.synchronization_mode,
39
40
  state: cluster.metadata.state,
40
- username: "usr",
41
- password: "pass123",
41
+ username: 'usr',
42
+ password: 'pass123',
42
43
  }
43
44
 
44
45
  subject_config.each { |key, value| subject.config[key] = value }
@@ -47,6 +48,7 @@ describe Chef::Knife::IonoscloudDbaasPostgresClusterCreate do
47
48
  expect(subject).to receive(:puts).with("Display Name: #{cluster.properties.display_name}")
48
49
  expect(subject).to receive(:puts).with("Postgres Version: #{cluster.properties.postgres_version}")
49
50
  expect(subject).to receive(:puts).with("Location: #{cluster.properties.location}")
51
+ expect(subject).to receive(:puts).with("Backup location: #{cluster.properties.backup_location}")
50
52
  expect(subject).to receive(:puts).with("Instances: #{cluster.properties.instances}")
51
53
  expect(subject).to receive(:puts).with("RAM Size: #{cluster.properties.ram}")
52
54
  expect(subject).to receive(:puts).with("Cores: #{cluster.properties.cores}")
@@ -82,7 +84,6 @@ describe Chef::Knife::IonoscloudDbaasPostgresClusterCreate do
82
84
  required_options = subject.instance_variable_get(:@required_options)
83
85
 
84
86
  arrays_without_one_element(required_options).each do |test_case|
85
-
86
87
  test_case[:array].each { |value| subject.config[value] = 'test' }
87
88
 
88
89
  expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
@@ -27,6 +27,7 @@ describe Chef::Knife::IonoscloudDbaasPostgresClusterDelete do
27
27
  expect(subject).to receive(:puts).with("Display Name: #{cluster.properties.display_name}")
28
28
  expect(subject).to receive(:puts).with("Postgres Version: #{cluster.properties.postgres_version}")
29
29
  expect(subject).to receive(:puts).with("Location: #{cluster.properties.location}")
30
+ expect(subject).to receive(:puts).with("Backup location: #{cluster.properties.backup_location}")
30
31
  expect(subject).to receive(:puts).with("Instances: #{cluster.properties.instances}")
31
32
  expect(subject).to receive(:puts).with("RAM Size: #{cluster.properties.ram}")
32
33
  expect(subject).to receive(:puts).with("Cores: #{cluster.properties.cores}")
@@ -92,7 +93,6 @@ describe Chef::Knife::IonoscloudDbaasPostgresClusterDelete do
92
93
  required_options = subject.instance_variable_get(:@required_options)
93
94
 
94
95
  arrays_without_one_element(required_options).each do |test_case|
95
-
96
96
  test_case[:array].each { |value| subject.config[value] = 'test' }
97
97
 
98
98
  expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
@@ -27,6 +27,7 @@ describe Chef::Knife::IonoscloudDbaasPostgresClusterGet do
27
27
  expect(subject).to receive(:puts).with("Display Name: #{cluster.properties.display_name}")
28
28
  expect(subject).to receive(:puts).with("Postgres Version: #{cluster.properties.postgres_version}")
29
29
  expect(subject).to receive(:puts).with("Location: #{cluster.properties.location}")
30
+ expect(subject).to receive(:puts).with("Backup location: #{cluster.properties.backup_location}")
30
31
  expect(subject).to receive(:puts).with("Instances: #{cluster.properties.instances}")
31
32
  expect(subject).to receive(:puts).with("RAM Size: #{cluster.properties.ram}")
32
33
  expect(subject).to receive(:puts).with("Cores: #{cluster.properties.cores}")
@@ -56,7 +57,6 @@ describe Chef::Knife::IonoscloudDbaasPostgresClusterGet do
56
57
  required_options = subject.instance_variable_get(:@required_options)
57
58
 
58
59
  arrays_without_one_element(required_options).each do |test_case|
59
-
60
60
  test_case[:array].each { |value| subject.config[value] = 'test' }
61
61
 
62
62
  expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
@@ -26,6 +26,7 @@ describe Chef::Knife::IonoscloudDbaasPostgresClusterList do
26
26
  subject.ui.color('Display Name', :bold),
27
27
  subject.ui.color('Postgres Version', :bold),
28
28
  subject.ui.color('Location', :bold),
29
+ subject.ui.color('Backup location', :bold),
29
30
  subject.ui.color('Instances', :bold),
30
31
  subject.ui.color('Datacenter ID', :bold),
31
32
  subject.ui.color('Lan ID', :bold),
@@ -38,6 +39,7 @@ describe Chef::Knife::IonoscloudDbaasPostgresClusterList do
38
39
  cluster_list << cluster.properties.display_name
39
40
  cluster_list << cluster.properties.postgres_version
40
41
  cluster_list << cluster.properties.location
42
+ cluster_list << cluster.properties.backup_location
41
43
  cluster_list << cluster.properties.instances
42
44
  cluster_list << cluster.properties.connections.first.datacenter_id
43
45
  cluster_list << cluster.properties.connections.first.lan_id
@@ -45,7 +47,7 @@ describe Chef::Knife::IonoscloudDbaasPostgresClusterList do
45
47
  cluster_list << cluster.metadata.state
46
48
  end
47
49
 
48
- expect(subject.ui).to receive(:list).with(cluster_list, :uneven_columns_across, 9)
50
+ expect(subject.ui).to receive(:list).with(cluster_list, :uneven_columns_across, 10)
49
51
 
50
52
  mock_dbaas_call_api(
51
53
  subject,
@@ -67,7 +69,6 @@ describe Chef::Knife::IonoscloudDbaasPostgresClusterList do
67
69
  required_options = subject.instance_variable_get(:@required_options)
68
70
 
69
71
  arrays_without_one_element(required_options).each do |test_case|
70
-
71
72
  test_case[:array].each { |value| subject.config[value] = 'test' }
72
73
 
73
74
  expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
@@ -42,7 +42,6 @@ describe Chef::Knife::IonoscloudDbaasPostgresClusterRestore do
42
42
  required_options = subject.instance_variable_get(:@required_options)
43
43
 
44
44
  arrays_without_one_element(required_options).each do |test_case|
45
-
46
45
  test_case[:array].each { |value| subject.config[value] = 'test' }
47
46
 
48
47
  expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
@@ -28,6 +28,7 @@ describe Chef::Knife::IonoscloudDbaasPostgresClusterUpdate do
28
28
  expect(subject).to receive(:puts).with("Display Name: #{subject_config[:display_name]}")
29
29
  expect(subject).to receive(:puts).with("Postgres Version: #{cluster.properties.postgres_version}")
30
30
  expect(subject).to receive(:puts).with("Location: #{cluster.properties.location}")
31
+ expect(subject).to receive(:puts).with("Backup location: #{cluster.properties.backup_location}")
31
32
  expect(subject).to receive(:puts).with("Instances: #{cluster.properties.instances}")
32
33
  expect(subject).to receive(:puts).with("RAM Size: #{cluster.properties.ram}")
33
34
  expect(subject).to receive(:puts).with("Cores: #{cluster.properties.cores}")
@@ -72,7 +73,6 @@ describe Chef::Knife::IonoscloudDbaasPostgresClusterUpdate do
72
73
  required_options = subject.instance_variable_get(:@required_options)
73
74
 
74
75
  arrays_without_one_element(required_options).each do |test_case|
75
-
76
76
  test_case[:array].each { |value| subject.config[value] = 'test' }
77
77
 
78
78
  expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
@@ -12,20 +12,24 @@ describe Chef::Knife::IonoscloudDbaasPostgresLogsGet do
12
12
  end
13
13
 
14
14
  describe '#run' do
15
- it 'should call LogsApi.cluster_logs_get' do
15
+ it 'should call LogsApi.cluster_logs_get and use start and end even if since and until are also provided' do
16
16
  cluster_logs = cluster_logs_mock
17
17
  subject_config = {
18
18
  ionoscloud_username: 'email',
19
19
  ionoscloud_password: 'password',
20
20
  cluster_id: 'cluster_id',
21
21
  limit: 3,
22
+ start: '2022-03-22T01:01:01Z',
23
+ end: '2022-03-22T09:01:01Z',
24
+ since: '2h',
25
+ until: '20m',
26
+ direction: 'FORWARD',
22
27
  yes: true,
23
28
  }
24
29
 
25
30
  subject_config.each { |key, value| subject.config[key] = value }
26
31
 
27
- cluster_logs.instances.each do
28
- |instance|
32
+ cluster_logs.instances.each do |instance|
29
33
  expect(subject).to receive(:puts).with("Instance Name: #{instance.name}")
30
34
  expect(subject).to receive(:puts).with(instance.messages.map { |message| message.message })
31
35
  end
@@ -37,6 +41,12 @@ describe Chef::Knife::IonoscloudDbaasPostgresLogsGet do
37
41
  method: 'GET',
38
42
  path: "/clusters/#{subject_config[:cluster_id]}/logs",
39
43
  operation: :'LogsApi.cluster_logs_get',
44
+ options: {
45
+ limit: subject_config[:limit],
46
+ direction: subject_config[:direction],
47
+ start: subject_config[:start],
48
+ _end: subject_config[:end],
49
+ },
40
50
  return_type: 'ClusterLogs',
41
51
  result: cluster_logs,
42
52
  },
@@ -46,11 +56,72 @@ describe Chef::Knife::IonoscloudDbaasPostgresLogsGet do
46
56
  expect { subject.run }.not_to raise_error(Exception)
47
57
  end
48
58
 
59
+ it 'should call LogsApi.cluster_logs_get using since and until' do
60
+ cluster_logs = cluster_logs_mock
61
+ subject_config = {
62
+ ionoscloud_username: 'email',
63
+ ionoscloud_password: 'password',
64
+ cluster_id: 'cluster_id',
65
+ limit: 3,
66
+ since: '2h',
67
+ until: '20m',
68
+ direction: 'FORWARD',
69
+ yes: true,
70
+ }
71
+
72
+ subject_config.each { |key, value| subject.config[key] = value }
73
+
74
+ cluster_logs.instances.each do |instance|
75
+ expect(subject).to receive(:puts).with("Instance Name: #{instance.name}")
76
+ expect(subject).to receive(:puts).with(instance.messages.map { |message| message.message })
77
+ end
78
+
79
+ mock_dbaas_call_api(
80
+ subject,
81
+ [
82
+ {
83
+ method: 'GET',
84
+ path: "/clusters/#{subject_config[:cluster_id]}/logs",
85
+ operation: :'LogsApi.cluster_logs_get',
86
+ options: {
87
+ limit: subject_config[:limit],
88
+ direction: subject_config[:direction],
89
+ start: (Time.now - 2 * 60 * 60).iso8601,
90
+ _end: (Time.now - 20 * 60).iso8601,
91
+ },
92
+ return_type: 'ClusterLogs',
93
+ result: cluster_logs,
94
+ },
95
+ ],
96
+ )
97
+
98
+ expect { subject.run }.not_to raise_error(Exception)
99
+ end
100
+
101
+ it 'should call not LogsApi.cluster_logs_get when using something different from minutes and hours for delta' do
102
+ subject_config = {
103
+ ionoscloud_username: 'email',
104
+ ionoscloud_password: 'password',
105
+ cluster_id: 'cluster_id',
106
+ since: '2d',
107
+ yes: true,
108
+ }
109
+
110
+ subject_config.each { |key, value| subject.config[key] = value }
111
+
112
+ expect(subject.ui).to receive(:error).with('Time delta may only be specified in hours(h) or minutes(m)!')
113
+
114
+ expect(subject.api_client_dbaas).not_to receive(:call_api)
115
+
116
+ expect { subject.run }.to raise_error(SystemExit) do |error|
117
+ expect(error.status).to eq(1)
118
+ end
119
+ end
120
+
49
121
  it 'should not make any call if any required option is missing' do
50
122
  required_options = subject.instance_variable_get(:@required_options)
51
123
 
52
124
  arrays_without_one_element(required_options).each do |test_case|
53
-
54
125
  test_case[:array].each { |value| subject.config[value] = 'test' }
55
126
 
56
127
  expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")