knife-ionoscloud 5.1.1 → 6.0.0.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/README.md +1 -1
- data/docs/subcommands/composite_server_create.md +9 -3
- data/docs/subcommands/cube_server_create.md +91 -0
- data/docs/subcommands/firewall_create.md +5 -2
- data/docs/subcommands/flowlog_create.md +63 -0
- data/docs/subcommands/flowlog_delete.md +51 -0
- data/docs/subcommands/flowlog_list.md +51 -0
- data/docs/subcommands/group_create.md +10 -1
- data/docs/subcommands/natgateway_create.md +41 -0
- data/docs/subcommands/natgateway_delete.md +35 -0
- data/docs/subcommands/natgateway_lan_add.md +46 -0
- data/docs/subcommands/natgateway_lan_remove.md +39 -0
- data/docs/subcommands/natgateway_list.md +35 -0
- data/docs/subcommands/natgateway_rule_add.md +66 -0
- data/docs/subcommands/natgateway_rule_list.md +38 -0
- data/docs/subcommands/natgateway_rule_remove.md +39 -0
- data/docs/subcommands/networkloadbalancer_create.md +54 -0
- data/docs/subcommands/networkloadbalancer_delete.md +35 -0
- data/docs/subcommands/networkloadbalancer_list.md +35 -0
- data/docs/subcommands/networkloadbalancer_rule_add.md +72 -0
- data/docs/subcommands/networkloadbalancer_rule_list.md +39 -0
- data/docs/subcommands/networkloadbalancer_rule_remove.md +39 -0
- data/docs/subcommands/networkloadbalancer_rule_target_add.md +64 -0
- data/docs/subcommands/networkloadbalancer_rule_target_list.md +43 -0
- data/docs/subcommands/networkloadbalancer_rule_target_remove.md +51 -0
- data/docs/subcommands/nic_create.md +3 -3
- data/docs/subcommands/nodepool_lan_add.md +49 -0
- data/docs/subcommands/nodepool_lan_remove.md +39 -0
- data/docs/subcommands/server_console.md +39 -0
- data/docs/subcommands/server_list.md +4 -1
- data/docs/subcommands/server_resume.md +35 -0
- data/docs/subcommands/server_suspend.md +35 -0
- data/docs/subcommands/server_token.md +39 -0
- data/docs/subcommands/server_upgrade.md +39 -0
- data/docs/subcommands/template_list.md +31 -0
- data/docs/subcommands/volume_create.md +2 -5
- data/docs/summary.md +29 -0
- data/knife-ionoscloud.gemspec +1 -1
- data/lib/chef/knife/ionoscloud_backupunit_create.rb +12 -16
- data/lib/chef/knife/ionoscloud_backupunit_delete.rb +2 -5
- data/lib/chef/knife/ionoscloud_backupunit_get.rb +33 -0
- data/lib/chef/knife/ionoscloud_backupunit_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_backupunit_ssourl.rb +1 -1
- data/lib/chef/knife/ionoscloud_backupunit_update.rb +62 -0
- data/lib/chef/knife/ionoscloud_base.rb +309 -1
- data/lib/chef/knife/ionoscloud_composite_server_create.rb +23 -5
- data/lib/chef/knife/ionoscloud_contract_list.rb +32 -23
- data/lib/chef/knife/ionoscloud_cube_server_create.rb +212 -0
- data/lib/chef/knife/ionoscloud_datacenter_create.rb +11 -14
- data/lib/chef/knife/ionoscloud_datacenter_delete.rb +2 -7
- data/lib/chef/knife/ionoscloud_datacenter_get.rb +33 -0
- data/lib/chef/knife/ionoscloud_datacenter_list.rb +4 -2
- data/lib/chef/knife/ionoscloud_datacenter_update.rb +67 -0
- data/lib/chef/knife/ionoscloud_firewall_create.rb +16 -21
- data/lib/chef/knife/ionoscloud_firewall_delete.rb +5 -13
- data/lib/chef/knife/ionoscloud_firewall_get.rb +52 -0
- data/lib/chef/knife/ionoscloud_firewall_list.rb +5 -3
- data/lib/chef/knife/ionoscloud_firewall_update.rb +133 -0
- data/lib/chef/knife/ionoscloud_flowlog_create.rb +116 -0
- data/lib/chef/knife/ionoscloud_flowlog_delete.rb +103 -0
- data/lib/chef/knife/ionoscloud_flowlog_get.rb +84 -0
- data/lib/chef/knife/ionoscloud_flowlog_list.rb +101 -0
- data/lib/chef/knife/ionoscloud_flowlog_update.rb +127 -0
- data/lib/chef/knife/ionoscloud_group_create.rb +33 -27
- data/lib/chef/knife/ionoscloud_group_delete.rb +1 -11
- data/lib/chef/knife/ionoscloud_group_get.rb +1 -13
- data/lib/chef/knife/ionoscloud_group_list.rb +19 -7
- data/lib/chef/knife/ionoscloud_group_update.rb +131 -0
- data/lib/chef/knife/ionoscloud_group_user_add.rb +1 -18
- data/lib/chef/knife/ionoscloud_group_user_remove.rb +1 -18
- data/lib/chef/knife/ionoscloud_image_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_ipblock_create.rb +10 -13
- data/lib/chef/knife/ionoscloud_ipblock_delete.rb +1 -4
- data/lib/chef/knife/ionoscloud_ipblock_get.rb +33 -0
- data/lib/chef/knife/ionoscloud_ipblock_update.rb +57 -0
- data/lib/chef/knife/ionoscloud_ipfailover_add.rb +1 -1
- data/lib/chef/knife/ionoscloud_ipfailover_remove.rb +1 -1
- data/lib/chef/knife/ionoscloud_k8s_create.rb +27 -35
- data/lib/chef/knife/ionoscloud_k8s_delete.rb +1 -9
- data/lib/chef/knife/ionoscloud_k8s_get.rb +33 -0
- data/lib/chef/knife/ionoscloud_k8s_update.rb +99 -0
- data/lib/chef/knife/ionoscloud_label_add.rb +1 -1
- data/lib/chef/knife/ionoscloud_label_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_label_remove.rb +1 -1
- data/lib/chef/knife/ionoscloud_lan_create.rb +6 -14
- data/lib/chef/knife/ionoscloud_lan_delete.rb +3 -4
- data/lib/chef/knife/ionoscloud_lan_get.rb +38 -0
- data/lib/chef/knife/ionoscloud_lan_list.rb +2 -1
- data/lib/chef/knife/ionoscloud_lan_update.rb +76 -0
- data/lib/chef/knife/ionoscloud_loadbalancer_create.rb +4 -14
- data/lib/chef/knife/ionoscloud_loadbalancer_delete.rb +2 -9
- data/lib/chef/knife/ionoscloud_loadbalancer_get.rb +3 -13
- data/lib/chef/knife/ionoscloud_loadbalancer_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_loadbalancer_nic_add.rb +3 -15
- data/lib/chef/knife/ionoscloud_loadbalancer_nic_remove.rb +3 -16
- data/lib/chef/knife/ionoscloud_loadbalancer_update.rb +73 -0
- data/lib/chef/knife/ionoscloud_location_list.rb +5 -3
- data/lib/chef/knife/ionoscloud_natgateway_create.rb +60 -0
- data/lib/chef/knife/ionoscloud_natgateway_delete.rb +54 -0
- data/lib/chef/knife/ionoscloud_natgateway_get.rb +42 -0
- data/lib/chef/knife/ionoscloud_natgateway_lan_add.rb +74 -0
- data/lib/chef/knife/ionoscloud_natgateway_lan_remove.rb +52 -0
- data/lib/chef/knife/ionoscloud_natgateway_list.rb +51 -0
- data/lib/chef/knife/ionoscloud_natgateway_rule_add.rb +107 -0
- data/lib/chef/knife/ionoscloud_natgateway_rule_list.rb +65 -0
- data/lib/chef/knife/ionoscloud_natgateway_rule_remove.rb +55 -0
- data/lib/chef/knife/ionoscloud_natgateway_rule_update.rb +116 -0
- data/lib/chef/knife/ionoscloud_natgateway_update.rb +84 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_create.rb +89 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_delete.rb +62 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_get.rb +42 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_list.rb +57 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_add.rb +141 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_list.rb +65 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_remove.rb +68 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_target_add.rb +124 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_target_list.rb +70 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_target_remove.rb +88 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_update.rb +148 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_update.rb +98 -0
- data/lib/chef/knife/ionoscloud_nic_create.rb +17 -22
- data/lib/chef/knife/ionoscloud_nic_delete.rb +3 -7
- data/lib/chef/knife/ionoscloud_nic_get.rb +49 -0
- data/lib/chef/knife/ionoscloud_nic_list.rb +9 -5
- data/lib/chef/knife/ionoscloud_nic_update.rb +96 -0
- data/lib/chef/knife/ionoscloud_node_get.rb +49 -0
- data/lib/chef/knife/ionoscloud_node_list.rb +0 -1
- data/lib/chef/knife/ionoscloud_nodepool_create.rb +35 -48
- data/lib/chef/knife/ionoscloud_nodepool_delete.rb +1 -7
- data/lib/chef/knife/ionoscloud_nodepool_get.rb +43 -0
- data/lib/chef/knife/ionoscloud_nodepool_lan_add.rb +104 -0
- data/lib/chef/knife/ionoscloud_nodepool_lan_remove.rb +72 -0
- data/lib/chef/knife/ionoscloud_nodepool_list.rb +3 -1
- data/lib/chef/knife/ionoscloud_nodepool_update.rb +124 -0
- data/lib/chef/knife/ionoscloud_pcc_create.rb +12 -18
- data/lib/chef/knife/ionoscloud_pcc_delete.rb +2 -10
- data/lib/chef/knife/ionoscloud_pcc_get.rb +33 -0
- data/lib/chef/knife/ionoscloud_pcc_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_pcc_update.rb +63 -0
- data/lib/chef/knife/ionoscloud_request_get.rb +40 -0
- data/lib/chef/knife/ionoscloud_request_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_request_status.rb +1 -1
- data/lib/chef/knife/ionoscloud_s3key_create.rb +3 -7
- data/lib/chef/knife/ionoscloud_s3key_delete.rb +4 -7
- data/lib/chef/knife/ionoscloud_s3key_get.rb +38 -0
- data/lib/chef/knife/ionoscloud_s3key_list.rb +2 -2
- data/lib/chef/knife/ionoscloud_server_console.rb +43 -0
- data/lib/chef/knife/ionoscloud_server_create.rb +14 -26
- data/lib/chef/knife/ionoscloud_server_delete.rb +3 -9
- data/lib/chef/knife/ionoscloud_server_get.rb +43 -0
- data/lib/chef/knife/ionoscloud_server_list.rb +16 -5
- data/lib/chef/knife/ionoscloud_server_reboot.rb +1 -1
- data/lib/chef/knife/ionoscloud_server_resume.rb +44 -0
- data/lib/chef/knife/ionoscloud_server_start.rb +1 -1
- data/lib/chef/knife/ionoscloud_server_stop.rb +1 -1
- data/lib/chef/knife/ionoscloud_server_suspend.rb +45 -0
- data/lib/chef/knife/ionoscloud_server_token.rb +43 -0
- data/lib/chef/knife/ionoscloud_server_update.rb +97 -0
- data/lib/chef/knife/ionoscloud_server_upgrade.rb +45 -0
- data/lib/chef/knife/ionoscloud_share_create.rb +7 -11
- data/lib/chef/knife/ionoscloud_share_delete.rb +2 -3
- data/lib/chef/knife/ionoscloud_share_get.rb +38 -0
- data/lib/chef/knife/ionoscloud_share_update.rb +70 -0
- data/lib/chef/knife/ionoscloud_snapshot_create.rb +2 -10
- data/lib/chef/knife/ionoscloud_snapshot_delete.rb +2 -7
- data/lib/chef/knife/ionoscloud_snapshot_get.rb +32 -0
- data/lib/chef/knife/ionoscloud_snapshot_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_snapshot_restore.rb +3 -14
- data/lib/chef/knife/ionoscloud_snapshot_update.rb +126 -0
- data/lib/chef/knife/ionoscloud_template_list.rb +47 -0
- data/lib/chef/knife/ionoscloud_user_create.rb +1 -8
- data/lib/chef/knife/ionoscloud_user_delete.rb +1 -6
- data/lib/chef/knife/ionoscloud_user_get.rb +32 -0
- data/lib/chef/knife/ionoscloud_user_ssourl.rb +1 -1
- data/lib/chef/knife/ionoscloud_user_update.rb +92 -0
- data/lib/chef/knife/ionoscloud_volume_attach.rb +1 -1
- data/lib/chef/knife/ionoscloud_volume_create.rb +18 -34
- data/lib/chef/knife/ionoscloud_volume_delete.rb +3 -9
- data/lib/chef/knife/ionoscloud_volume_detach.rb +1 -1
- data/lib/chef/knife/ionoscloud_volume_get.rb +36 -0
- data/lib/chef/knife/ionoscloud_volume_list.rb +2 -2
- data/lib/chef/knife/ionoscloud_volume_update.rb +106 -0
- data/lib/knife-ionoscloud/version.rb +1 -1
- data/spec/chef/knife/ionoscloud_backupunit_create_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_backupunit_delete_spec.rb +5 -5
- data/spec/chef/knife/ionoscloud_backupunit_get_spec.rb +65 -0
- data/spec/chef/knife/ionoscloud_backupunit_list_spec.rb +1 -1
- data/spec/chef/knife/ionoscloud_backupunit_ssourl_spec.rb +3 -3
- data/spec/chef/knife/ionoscloud_backupunit_update_spec.rb +78 -0
- data/spec/chef/knife/ionoscloud_base_spec.rb +4 -4
- data/spec/chef/knife/ionoscloud_composite_server_create_spec.rb +11 -8
- data/spec/chef/knife/ionoscloud_contract_list_spec.rb +32 -27
- data/spec/chef/knife/ionoscloud_cube_server_create_spec.rb +249 -0
- data/spec/chef/knife/ionoscloud_datacenter_create_spec.rb +6 -2
- data/spec/chef/knife/ionoscloud_datacenter_delete_spec.rb +8 -5
- data/spec/chef/knife/ionoscloud_datacenter_get_spec.rb +69 -0
- data/spec/chef/knife/ionoscloud_datacenter_list_spec.rb +5 -3
- data/spec/chef/knife/ionoscloud_datacenter_update_spec.rb +82 -0
- data/spec/chef/knife/ionoscloud_firewall_create_spec.rb +5 -3
- data/spec/chef/knife/ionoscloud_firewall_delete_spec.rb +6 -5
- data/spec/chef/knife/ionoscloud_firewall_get_spec.rb +77 -0
- data/spec/chef/knife/ionoscloud_firewall_list_spec.rb +5 -3
- data/spec/chef/knife/ionoscloud_firewall_update_spec.rb +117 -0
- data/spec/chef/knife/ionoscloud_flowlog_create_spec.rb +254 -0
- data/spec/chef/knife/ionoscloud_flowlog_delete_spec.rb +360 -0
- data/spec/chef/knife/ionoscloud_flowlog_get_spec.rb +171 -0
- data/spec/chef/knife/ionoscloud_flowlog_list_spec.rb +264 -0
- data/spec/chef/knife/ionoscloud_flowlog_update_spec.rb +244 -0
- data/spec/chef/knife/ionoscloud_group_create_spec.rb +9 -0
- data/spec/chef/knife/ionoscloud_group_delete_spec.rb +6 -0
- data/spec/chef/knife/ionoscloud_group_get_spec.rb +6 -0
- data/spec/chef/knife/ionoscloud_group_list_spec.rb +26 -8
- data/spec/chef/knife/ionoscloud_group_update_spec.rb +121 -0
- data/spec/chef/knife/ionoscloud_group_user_add_spec.rb +6 -0
- data/spec/chef/knife/ionoscloud_group_user_remove_spec.rb +6 -0
- data/spec/chef/knife/ionoscloud_image_list_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_ipblock_get_spec.rb +66 -0
- data/spec/chef/knife/ionoscloud_ipblock_update_spec.rb +79 -0
- data/spec/chef/knife/ionoscloud_ipfailover_add_spec.rb +4 -4
- data/spec/chef/knife/ionoscloud_ipfailover_remove_spec.rb +7 -7
- data/spec/chef/knife/ionoscloud_k8s_create_spec.rb +7 -0
- data/spec/chef/knife/ionoscloud_k8s_delete_spec.rb +16 -11
- data/spec/chef/knife/ionoscloud_k8s_get_spec.rb +72 -0
- data/spec/chef/knife/ionoscloud_k8s_update_spec.rb +114 -0
- data/spec/chef/knife/ionoscloud_kubeconfig_get_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_label_add_spec.rb +10 -10
- data/spec/chef/knife/ionoscloud_label_list_spec.rb +14 -14
- data/spec/chef/knife/ionoscloud_label_remove_spec.rb +20 -20
- data/spec/chef/knife/ionoscloud_lan_create_spec.rb +4 -3
- data/spec/chef/knife/ionoscloud_lan_delete_spec.rb +7 -5
- data/spec/chef/knife/ionoscloud_lan_get_spec.rb +68 -0
- data/spec/chef/knife/ionoscloud_lan_list_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_lan_update_spec.rb +87 -0
- data/spec/chef/knife/ionoscloud_loadbalancer_create_spec.rb +3 -3
- data/spec/chef/knife/ionoscloud_loadbalancer_delete_spec.rb +5 -5
- data/spec/chef/knife/ionoscloud_loadbalancer_get_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_loadbalancer_list_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_loadbalancer_nic_add_spec.rb +6 -6
- data/spec/chef/knife/ionoscloud_loadbalancer_nic_remove_spec.rb +6 -6
- data/spec/chef/knife/ionoscloud_loadbalancer_update_spec.rb +89 -0
- data/spec/chef/knife/ionoscloud_location_list_spec.rb +5 -3
- data/spec/chef/knife/ionoscloud_natgateway_create_spec.rb +92 -0
- data/spec/chef/knife/ionoscloud_natgateway_delete_spec.rb +118 -0
- data/spec/chef/knife/ionoscloud_natgateway_get_spec.rb +81 -0
- data/spec/chef/knife/ionoscloud_natgateway_lan_add_spec.rb +158 -0
- data/spec/chef/knife/ionoscloud_natgateway_lan_remove_spec.rb +209 -0
- data/spec/chef/knife/ionoscloud_natgateway_list_spec.rb +79 -0
- data/spec/chef/knife/ionoscloud_natgateway_rule_add_spec.rb +99 -0
- data/spec/chef/knife/ionoscloud_natgateway_rule_list_spec.rb +92 -0
- data/spec/chef/knife/ionoscloud_natgateway_rule_remove_spec.rb +78 -0
- data/spec/chef/knife/ionoscloud_natgateway_rule_update_spec.rb +121 -0
- data/spec/chef/knife/ionoscloud_natgateway_update_spec.rb +121 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_create_spec.rb +93 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_delete_spec.rb +120 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_get_spec.rb +82 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_list_spec.rb +88 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_add_spec.rb +105 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_list_spec.rb +89 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_remove_spec.rb +150 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_target_add_spec.rb +113 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_target_list_spec.rb +85 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_target_remove_spec.rb +281 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_update_spec.rb +163 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_update_spec.rb +107 -0
- data/spec/chef/knife/ionoscloud_nic_create_spec.rb +9 -5
- data/spec/chef/knife/ionoscloud_nic_delete_spec.rb +8 -6
- data/spec/chef/knife/ionoscloud_nic_get_spec.rb +72 -0
- data/spec/chef/knife/ionoscloud_nic_list_spec.rb +12 -6
- data/spec/chef/knife/ionoscloud_nic_update_spec.rb +97 -0
- data/spec/chef/knife/ionoscloud_node_get_spec.rb +70 -0
- data/spec/chef/knife/ionoscloud_nodepool_create_spec.rb +10 -5
- data/spec/chef/knife/ionoscloud_nodepool_delete_spec.rb +14 -0
- data/spec/chef/knife/ionoscloud_nodepool_get_spec.rb +83 -0
- data/spec/chef/knife/ionoscloud_nodepool_lan_add_spec.rb +222 -0
- data/spec/chef/knife/ionoscloud_nodepool_lan_remove.rb +196 -0
- data/spec/chef/knife/ionoscloud_nodepool_list_spec.rb +3 -1
- data/spec/chef/knife/ionoscloud_nodepool_update_spec.rb +134 -0
- data/spec/chef/knife/ionoscloud_pcc_create_spec.rb +11 -8
- data/spec/chef/knife/ionoscloud_pcc_delete_spec.rb +7 -7
- data/spec/chef/knife/ionoscloud_pcc_get_spec.rb +71 -0
- data/spec/chef/knife/ionoscloud_pcc_list_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_pcc_update_spec.rb +83 -0
- data/spec/chef/knife/ionoscloud_request_get_spec.rb +69 -0
- data/spec/chef/knife/ionoscloud_request_list_spec.rb +16 -16
- data/spec/chef/knife/ionoscloud_request_status_spec.rb +3 -3
- data/spec/chef/knife/ionoscloud_s3key_create_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_s3key_delete_spec.rb +5 -5
- data/spec/chef/knife/ionoscloud_s3key_get_spec.rb +66 -0
- data/spec/chef/knife/ionoscloud_s3key_list_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_server_console_spec.rb +97 -0
- data/spec/chef/knife/ionoscloud_server_create_spec.rb +6 -3
- data/spec/chef/knife/ionoscloud_server_delete_spec.rb +8 -5
- data/spec/chef/knife/ionoscloud_server_get_spec.rb +74 -0
- data/spec/chef/knife/ionoscloud_server_list_spec.rb +63 -5
- data/spec/chef/knife/ionoscloud_server_reboot_spec.rb +3 -5
- data/spec/chef/knife/ionoscloud_server_resume_spec.rb +93 -0
- data/spec/chef/knife/ionoscloud_server_start_spec.rb +3 -5
- data/spec/chef/knife/ionoscloud_server_stop_spec.rb +3 -5
- data/spec/chef/knife/ionoscloud_server_suspend_spec.rb +93 -0
- data/spec/chef/knife/ionoscloud_server_token_spec.rb +97 -0
- data/spec/chef/knife/ionoscloud_server_update_spec.rb +105 -0
- data/spec/chef/knife/ionoscloud_server_upgrade_spec.rb +96 -0
- data/spec/chef/knife/ionoscloud_share_get_spec.rb +66 -0
- data/spec/chef/knife/ionoscloud_share_update_spec.rb +91 -0
- data/spec/chef/knife/ionoscloud_snapshot_create_spec.rb +15 -3
- data/spec/chef/knife/ionoscloud_snapshot_delete_spec.rb +17 -5
- data/spec/chef/knife/ionoscloud_snapshot_get_spec.rb +79 -0
- data/spec/chef/knife/ionoscloud_snapshot_list_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_snapshot_restore_spec.rb +12 -3
- data/spec/chef/knife/ionoscloud_snapshot_update_spec.rb +113 -0
- data/spec/chef/knife/ionoscloud_template_list_spec.rb +78 -0
- data/spec/chef/knife/ionoscloud_user_create_spec.rb +3 -1
- data/spec/chef/knife/ionoscloud_user_delete_spec.rb +4 -2
- data/spec/chef/knife/ionoscloud_user_get_spec.rb +70 -0
- data/spec/chef/knife/ionoscloud_user_ssourl_spec.rb +3 -3
- data/spec/chef/knife/ionoscloud_user_update_spec.rb +110 -0
- data/spec/chef/knife/ionoscloud_volume_attach_spec.rb +4 -4
- data/spec/chef/knife/ionoscloud_volume_create_spec.rb +21 -11
- data/spec/chef/knife/ionoscloud_volume_delete_spec.rb +15 -5
- data/spec/chef/knife/ionoscloud_volume_detach_spec.rb +5 -5
- data/spec/chef/knife/ionoscloud_volume_get_spec.rb +81 -0
- data/spec/chef/knife/ionoscloud_volume_list_spec.rb +4 -4
- data/spec/chef/knife/ionoscloud_volume_update_spec.rb +116 -0
- data/spec/spec_helper.rb +251 -39
- metadata +245 -6
@@ -0,0 +1,99 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ionoscloud_natgateway_rule_add'
|
3
|
+
|
4
|
+
Chef::Knife::IonoscloudNatgatewayRuleAdd.load_deps
|
5
|
+
|
6
|
+
describe Chef::Knife::IonoscloudNatgatewayRuleAdd do
|
7
|
+
before :each do
|
8
|
+
subject { Chef::Knife::IonoscloudNatgatewayRuleAdd.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 NATGatewaysApi.datacenters_natgateways_rules_post when the ID is valid' do
|
16
|
+
natgateway = natgateway_mock
|
17
|
+
rule = natgateway_rule_mock
|
18
|
+
subject_config = {
|
19
|
+
ionoscloud_username: 'email',
|
20
|
+
ionoscloud_password: 'password',
|
21
|
+
datacenter_id: 'datacenter_id',
|
22
|
+
natgateway_id: natgateway.id,
|
23
|
+
name: rule.properties.name,
|
24
|
+
type: rule.properties.type,
|
25
|
+
protocol: rule.properties.protocol,
|
26
|
+
public_ip: rule.properties.public_ip,
|
27
|
+
source_subnet: rule.properties.source_subnet,
|
28
|
+
target_subnet: rule.properties.target_subnet,
|
29
|
+
target_port_range_start: rule.properties.target_port_range.start,
|
30
|
+
target_port_range_end: rule.properties.target_port_range._end,
|
31
|
+
yes: true,
|
32
|
+
}
|
33
|
+
|
34
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
35
|
+
|
36
|
+
expect(subject).to receive(:puts).with("ID: #{natgateway.id}")
|
37
|
+
expect(subject).to receive(:puts).with("Name: #{natgateway.properties.name}")
|
38
|
+
expect(subject).to receive(:puts).with("IPS: #{natgateway.properties.public_ips}")
|
39
|
+
expect(subject).to receive(:puts).with("LANS: #{natgateway.properties.lans.map { |el| { id: el.id, gateway_ips: el.gateway_ips } }}")
|
40
|
+
expect(subject).to receive(:puts).with("Rules: #{(natgateway.entities.rules.items + [rule]).map do |el|
|
41
|
+
{
|
42
|
+
id: el.id,
|
43
|
+
name: el.properties.name,
|
44
|
+
type: el.properties.type,
|
45
|
+
protocol: el.properties.protocol,
|
46
|
+
public_ip: el.properties.public_ip,
|
47
|
+
source_subnet: el.properties.source_subnet,
|
48
|
+
target_subnet: el.properties.target_subnet,
|
49
|
+
target_port_range_start: el.properties.target_port_range ? el.properties.target_port_range.start : '',
|
50
|
+
target_port_range_end: el.properties.target_port_range ? el.properties.target_port_range._end : '',
|
51
|
+
}
|
52
|
+
end}")
|
53
|
+
expect(subject).to receive(:puts).with("Flowlogs: #{natgateway.entities.flowlogs.items.map { |flowlog| flowlog.id }}")
|
54
|
+
|
55
|
+
mock_wait_for(subject)
|
56
|
+
mock_call_api(
|
57
|
+
subject,
|
58
|
+
[
|
59
|
+
{
|
60
|
+
method: 'POST',
|
61
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{natgateway.id}/rules",
|
62
|
+
operation: :'NATGatewaysApi.datacenters_natgateways_rules_post',
|
63
|
+
body: { properties: rule.properties.to_hash },
|
64
|
+
return_type: 'NatGatewayRule',
|
65
|
+
},
|
66
|
+
{
|
67
|
+
method: 'GET',
|
68
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{natgateway.id}",
|
69
|
+
operation: :'NATGatewaysApi.datacenters_natgateways_find_by_nat_gateway_id',
|
70
|
+
return_type: 'NatGateway',
|
71
|
+
result: natgateway,
|
72
|
+
},
|
73
|
+
],
|
74
|
+
)
|
75
|
+
|
76
|
+
natgateway.entities.rules.items << rule
|
77
|
+
|
78
|
+
expect { subject.run }.not_to raise_error(Exception)
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'should not make any call if any required option is missing' do
|
82
|
+
required_options = subject.instance_variable_get(:@required_options)
|
83
|
+
|
84
|
+
arrays_without_one_element(required_options).each do |test_case|
|
85
|
+
|
86
|
+
test_case[:array].each { |value| subject.config[value] = 'test' }
|
87
|
+
|
88
|
+
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
89
|
+
expect(subject.api_client).not_to receive(:call_api)
|
90
|
+
|
91
|
+
expect { subject.run }.to raise_error(SystemExit) do |error|
|
92
|
+
expect(error.status).to eq(1)
|
93
|
+
end
|
94
|
+
|
95
|
+
required_options.each { |value| subject.config[value] = nil }
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ionoscloud_natgateway_rule_list'
|
3
|
+
|
4
|
+
Chef::Knife::IonoscloudNatgatewayRuleList.load_deps
|
5
|
+
|
6
|
+
describe Chef::Knife::IonoscloudNatgatewayRuleList do
|
7
|
+
before :each do
|
8
|
+
subject { Chef::Knife::IonoscloudNatgatewayRuleList.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 NATGatewayApi.datacenters_natgateways_get' do
|
16
|
+
natgateway_rules = natgateway_rules_mock
|
17
|
+
subject_config = {
|
18
|
+
ionoscloud_username: 'email',
|
19
|
+
ionoscloud_password: 'password',
|
20
|
+
datacenter_id: 'datacenter_id',
|
21
|
+
natgateway_id: 'natgateway_id',
|
22
|
+
}
|
23
|
+
|
24
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
25
|
+
|
26
|
+
natgateway_rule_list = [
|
27
|
+
subject.ui.color('ID', :bold),
|
28
|
+
subject.ui.color('Name', :bold),
|
29
|
+
subject.ui.color('Type', :bold),
|
30
|
+
subject.ui.color('Protocol', :bold),
|
31
|
+
subject.ui.color('Public IP', :bold),
|
32
|
+
subject.ui.color('Source Subnet', :bold),
|
33
|
+
subject.ui.color('Target Subnet', :bold),
|
34
|
+
subject.ui.color('Target Port Range Start', :bold),
|
35
|
+
subject.ui.color('Target Port Range End', :bold),
|
36
|
+
natgateway_rules.items[0].id,
|
37
|
+
natgateway_rules.items[0].properties.name,
|
38
|
+
natgateway_rules.items[0].properties.type,
|
39
|
+
natgateway_rules.items[0].properties.protocol,
|
40
|
+
natgateway_rules.items[0].properties.public_ip,
|
41
|
+
natgateway_rules.items[0].properties.source_subnet,
|
42
|
+
natgateway_rules.items[0].properties.target_subnet,
|
43
|
+
(natgateway_rules.items[0].properties.target_port_range ? natgateway_rules.items[0].properties.target_port_range.start : ''),
|
44
|
+
(natgateway_rules.items[0].properties.target_port_range ? natgateway_rules.items[0].properties.target_port_range._end : ''),
|
45
|
+
natgateway_rules.items[1].id,
|
46
|
+
natgateway_rules.items[1].properties.name,
|
47
|
+
natgateway_rules.items[1].properties.type,
|
48
|
+
natgateway_rules.items[1].properties.protocol,
|
49
|
+
natgateway_rules.items[1].properties.public_ip,
|
50
|
+
natgateway_rules.items[1].properties.source_subnet,
|
51
|
+
natgateway_rules.items[1].properties.target_subnet,
|
52
|
+
(natgateway_rules.items[1].properties.target_port_range ? natgateway_rules.items[1].properties.target_port_range.start : ''),
|
53
|
+
(natgateway_rules.items[1].properties.target_port_range ? natgateway_rules.items[1].properties.target_port_range._end : ''),
|
54
|
+
]
|
55
|
+
|
56
|
+
expect(subject.ui).to receive(:list).with(natgateway_rule_list, :uneven_columns_across, 9)
|
57
|
+
|
58
|
+
mock_call_api(
|
59
|
+
subject,
|
60
|
+
[
|
61
|
+
{
|
62
|
+
method: 'GET',
|
63
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{subject_config[:natgateway_id]}/rules",
|
64
|
+
operation: :'NATGatewaysApi.datacenters_natgateways_rules_get',
|
65
|
+
return_type: 'NatGatewayRules',
|
66
|
+
result: natgateway_rules,
|
67
|
+
},
|
68
|
+
],
|
69
|
+
)
|
70
|
+
|
71
|
+
expect { subject.run }.not_to raise_error(Exception)
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'should not make any call if any required option is missing' do
|
75
|
+
required_options = subject.instance_variable_get(:@required_options)
|
76
|
+
|
77
|
+
arrays_without_one_element(required_options).each do |test_case|
|
78
|
+
|
79
|
+
test_case[:array].each { |value| subject.config[value] = 'test' }
|
80
|
+
|
81
|
+
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
82
|
+
expect(subject.api_client).not_to receive(:call_api)
|
83
|
+
|
84
|
+
expect { subject.run }.to raise_error(SystemExit) do |error|
|
85
|
+
expect(error.status).to eq(1)
|
86
|
+
end
|
87
|
+
|
88
|
+
required_options.each { |value| subject.config[value] = nil }
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ionoscloud_natgateway_rule_remove'
|
3
|
+
|
4
|
+
Chef::Knife::IonoscloudNatgatewayRuleRemove.load_deps
|
5
|
+
|
6
|
+
describe Chef::Knife::IonoscloudNatgatewayRuleRemove do
|
7
|
+
before :each do
|
8
|
+
subject { Chef::Knife::IonoscloudNatgatewayRuleRemove.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 NATGatewaysApi.datacenters_natgateways_rules_post when the ID is valid' do
|
16
|
+
rule = natgateway_rule_mock
|
17
|
+
natgateway = natgateway_mock(rules: [rule])
|
18
|
+
subject_config = {
|
19
|
+
ionoscloud_username: 'email',
|
20
|
+
ionoscloud_password: 'password',
|
21
|
+
datacenter_id: 'datacenter_id',
|
22
|
+
natgateway_id: natgateway.id,
|
23
|
+
yes: true,
|
24
|
+
}
|
25
|
+
|
26
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
27
|
+
subject.name_args = [rule.id]
|
28
|
+
|
29
|
+
expect(subject).to receive(:puts).with("ID: #{natgateway.id}")
|
30
|
+
expect(subject).to receive(:puts).with("Name: #{natgateway.properties.name}")
|
31
|
+
expect(subject).to receive(:puts).with("IPS: #{natgateway.properties.public_ips}")
|
32
|
+
expect(subject).to receive(:puts).with("LANS: #{natgateway.properties.lans.map { |el| { id: el.id, gateway_ips: el.gateway_ips } }}")
|
33
|
+
expect(subject).to receive(:puts).with("Rules: #{[]}")
|
34
|
+
expect(subject).to receive(:puts).with("Flowlogs: #{natgateway.entities.flowlogs.items.map { |flowlog| flowlog.id }}")
|
35
|
+
|
36
|
+
mock_wait_for(subject)
|
37
|
+
mock_call_api(
|
38
|
+
subject,
|
39
|
+
[
|
40
|
+
{
|
41
|
+
method: 'DELETE',
|
42
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{natgateway.id}/rules/#{rule.id}",
|
43
|
+
operation: :'NATGatewaysApi.datacenters_natgateways_rules_delete',
|
44
|
+
},
|
45
|
+
{
|
46
|
+
method: 'GET',
|
47
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{natgateway.id}",
|
48
|
+
operation: :'NATGatewaysApi.datacenters_natgateways_find_by_nat_gateway_id',
|
49
|
+
return_type: 'NatGateway',
|
50
|
+
result: natgateway,
|
51
|
+
},
|
52
|
+
],
|
53
|
+
)
|
54
|
+
|
55
|
+
natgateway.entities.rules.items = []
|
56
|
+
|
57
|
+
expect { subject.run }.not_to raise_error(Exception)
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'should not make any call if any required option is missing' do
|
61
|
+
required_options = subject.instance_variable_get(:@required_options)
|
62
|
+
|
63
|
+
arrays_without_one_element(required_options).each do |test_case|
|
64
|
+
|
65
|
+
test_case[:array].each { |value| subject.config[value] = 'test' }
|
66
|
+
|
67
|
+
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
68
|
+
expect(subject.api_client).not_to receive(:call_api)
|
69
|
+
|
70
|
+
expect { subject.run }.to raise_error(SystemExit) do |error|
|
71
|
+
expect(error.status).to eq(1)
|
72
|
+
end
|
73
|
+
|
74
|
+
required_options.each { |value| subject.config[value] = nil }
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ionoscloud_natgateway_rule_update'
|
3
|
+
|
4
|
+
Chef::Knife::IonoscloudNatgatewayRuleUpdate.load_deps
|
5
|
+
|
6
|
+
describe Chef::Knife::IonoscloudNatgatewayRuleUpdate do
|
7
|
+
before :each do
|
8
|
+
subject { Chef::Knife::IonoscloudNatgatewayRuleUpdate.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 NATGatewaysApi.datacenters_natgateways_rules_patch' do
|
16
|
+
natgateway = natgateway_mock
|
17
|
+
natgateway_rule = natgateway.entities.rules.items[0]
|
18
|
+
|
19
|
+
subject_config = {
|
20
|
+
ionoscloud_username: 'email',
|
21
|
+
ionoscloud_password: 'password',
|
22
|
+
datacenter_id: 'datacenter_id',
|
23
|
+
natgateway_id: natgateway.id,
|
24
|
+
natgateway_rule_id: natgateway_rule.id,
|
25
|
+
name: natgateway_rule.properties.name + '_edited',
|
26
|
+
type: 'SNAT',
|
27
|
+
protocol: 'UDP',
|
28
|
+
source_subnet: '10.2.1.1/24',
|
29
|
+
public_ip: '1.1.1.1',
|
30
|
+
target_subnet: '123.2.1.1/24',
|
31
|
+
target_port_range_start: natgateway_rule.properties.target_port_range.start + 10,
|
32
|
+
target_port_range_end: natgateway_rule.properties.target_port_range._end + 1,
|
33
|
+
yes: true,
|
34
|
+
}
|
35
|
+
|
36
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
37
|
+
|
38
|
+
natgateway.entities.rules.items[0].properties.name = subject_config[:name]
|
39
|
+
natgateway.entities.rules.items[0].properties.type = subject_config[:type]
|
40
|
+
natgateway.entities.rules.items[0].properties.protocol = subject_config[:protocol]
|
41
|
+
natgateway.entities.rules.items[0].properties.source_subnet = subject_config[:source_subnet]
|
42
|
+
natgateway.entities.rules.items[0].properties.public_ip = subject_config[:public_ip]
|
43
|
+
natgateway.entities.rules.items[0].properties.target_subnet = subject_config[:target_subnet]
|
44
|
+
natgateway.entities.rules.items[0].properties.target_port_range.start = subject_config[:target_port_range_start]
|
45
|
+
natgateway.entities.rules.items[0].properties.target_port_range._end = subject_config[:target_port_range_end]
|
46
|
+
|
47
|
+
expect(subject).to receive(:puts).with("ID: #{natgateway.id}")
|
48
|
+
expect(subject).to receive(:puts).with("Name: #{natgateway.properties.name}")
|
49
|
+
expect(subject).to receive(:puts).with("IPS: #{natgateway.properties.public_ips}")
|
50
|
+
expect(subject).to receive(:puts).with("LANS: #{natgateway.properties.lans.map { |el| { id: el.id, gateway_ips: el.gateway_ips } }}")
|
51
|
+
expect(subject).to receive(:puts).with("Rules: #{natgateway.entities.rules.items.map do |el|
|
52
|
+
{
|
53
|
+
id: el.id,
|
54
|
+
name: el.properties.name,
|
55
|
+
type: el.properties.type,
|
56
|
+
protocol: el.properties.protocol,
|
57
|
+
public_ip: el.properties.public_ip,
|
58
|
+
source_subnet: el.properties.source_subnet,
|
59
|
+
target_subnet: el.properties.target_subnet,
|
60
|
+
target_port_range_start: el.properties.target_port_range ? el.properties.target_port_range.start : '',
|
61
|
+
target_port_range_end: el.properties.target_port_range ? el.properties.target_port_range._end : '',
|
62
|
+
}
|
63
|
+
end}")
|
64
|
+
expect(subject).to receive(:puts).with("Flowlogs: #{natgateway.entities.flowlogs.items.map { |flowlog| flowlog.id }}")
|
65
|
+
|
66
|
+
mock_wait_for(subject)
|
67
|
+
mock_call_api(
|
68
|
+
subject,
|
69
|
+
[
|
70
|
+
{
|
71
|
+
method: 'PATCH',
|
72
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{subject_config[:natgateway_id]}/"\
|
73
|
+
"rules/#{subject_config[:natgateway_rule_id]}",
|
74
|
+
operation: :'NATGatewaysApi.datacenters_natgateways_rules_patch',
|
75
|
+
return_type: 'NatGatewayRule',
|
76
|
+
body: {
|
77
|
+
name: subject_config[:name],
|
78
|
+
type: subject_config[:type],
|
79
|
+
protocol: subject_config[:protocol],
|
80
|
+
publicIp: subject_config[:public_ip],
|
81
|
+
sourceSubnet: subject_config[:source_subnet],
|
82
|
+
targetSubnet: subject_config[:target_subnet],
|
83
|
+
targetPortRange: {
|
84
|
+
start: subject_config[:target_port_range_start],
|
85
|
+
end: subject_config[:target_port_range_end],
|
86
|
+
}
|
87
|
+
},
|
88
|
+
result: natgateway,
|
89
|
+
},
|
90
|
+
{
|
91
|
+
method: 'GET',
|
92
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{subject_config[:natgateway_id]}",
|
93
|
+
operation: :'NATGatewaysApi.datacenters_natgateways_find_by_nat_gateway_id',
|
94
|
+
return_type: 'NatGateway',
|
95
|
+
result: natgateway,
|
96
|
+
},
|
97
|
+
],
|
98
|
+
)
|
99
|
+
|
100
|
+
expect { subject.run }.not_to raise_error(Exception)
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'should not make any call if any required option is missing' do
|
104
|
+
required_options = subject.instance_variable_get(:@required_options)
|
105
|
+
|
106
|
+
arrays_without_one_element(required_options).each do |test_case|
|
107
|
+
|
108
|
+
test_case[:array].each { |value| subject.config[value] = 'test' }
|
109
|
+
|
110
|
+
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
111
|
+
expect(subject.api_client).not_to receive(:call_api)
|
112
|
+
|
113
|
+
expect { subject.run }.to raise_error(SystemExit) do |error|
|
114
|
+
expect(error.status).to eq(1)
|
115
|
+
end
|
116
|
+
|
117
|
+
required_options.each { |value| subject.config[value] = nil }
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ionoscloud_natgateway_update'
|
3
|
+
|
4
|
+
Chef::Knife::IonoscloudNatgatewayUpdate.load_deps
|
5
|
+
|
6
|
+
describe Chef::Knife::IonoscloudNatgatewayUpdate do
|
7
|
+
before :each do
|
8
|
+
subject { Chef::Knife::IonoscloudNatgatewayUpdate.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 NATGatewaysApi.datacenters_natgateways_patch' do
|
16
|
+
natgateway = natgateway_mock
|
17
|
+
subject_config = {
|
18
|
+
ionoscloud_username: 'email',
|
19
|
+
ionoscloud_password: 'password',
|
20
|
+
datacenter_id: 'datacenter_id',
|
21
|
+
natgateway_id: natgateway.id,
|
22
|
+
name: natgateway.properties.name + '_edited',
|
23
|
+
ips: (natgateway.properties.public_ips + ['3.3.3.3']).join(','),
|
24
|
+
lans: [
|
25
|
+
{
|
26
|
+
'id' => 1,
|
27
|
+
'gateway_ips' => [
|
28
|
+
'10.8.152.227/24',
|
29
|
+
'10.8.152.227/24',
|
30
|
+
],
|
31
|
+
},
|
32
|
+
],
|
33
|
+
yes: true,
|
34
|
+
}
|
35
|
+
|
36
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
37
|
+
|
38
|
+
parsed_lans = subject_config[:lans].map do
|
39
|
+
|lan|
|
40
|
+
Ionoscloud::NatGatewayLanProperties.new(
|
41
|
+
id: lan['id'],
|
42
|
+
gateway_ips: lan['gateway_ips'],
|
43
|
+
)
|
44
|
+
end
|
45
|
+
|
46
|
+
expect(subject).to receive(:puts).with("ID: #{natgateway.id}")
|
47
|
+
expect(subject).to receive(:puts).with("Name: #{subject_config[:name]}")
|
48
|
+
expect(subject).to receive(:puts).with("IPS: #{subject_config[:ips].split(',')}")
|
49
|
+
expect(subject).to receive(:puts).with("LANS: #{subject_config[:lans].map do |lan|
|
50
|
+
{
|
51
|
+
id: lan['id'],
|
52
|
+
gateway_ips: lan['gateway_ips'],
|
53
|
+
}
|
54
|
+
end}")
|
55
|
+
expect(subject).to receive(:puts).with("Rules: #{natgateway.entities.rules.items.map do |el|
|
56
|
+
{
|
57
|
+
id: el.id,
|
58
|
+
name: el.properties.name,
|
59
|
+
type: el.properties.type,
|
60
|
+
protocol: el.properties.protocol,
|
61
|
+
public_ip: el.properties.public_ip,
|
62
|
+
source_subnet: el.properties.source_subnet,
|
63
|
+
target_subnet: el.properties.target_subnet,
|
64
|
+
target_port_range_start: el.properties.target_port_range ? el.properties.target_port_range.start : '',
|
65
|
+
target_port_range_end: el.properties.target_port_range ? el.properties.target_port_range._end : '',
|
66
|
+
}
|
67
|
+
end}")
|
68
|
+
expect(subject).to receive(:puts).with("Flowlogs: #{natgateway.entities.flowlogs.items.map { |flowlog| flowlog.id }}")
|
69
|
+
|
70
|
+
natgateway.properties.name = subject_config[:name]
|
71
|
+
natgateway.properties.public_ips = subject_config[:ips].split(',')
|
72
|
+
natgateway.properties.lans = parsed_lans
|
73
|
+
|
74
|
+
mock_wait_for(subject)
|
75
|
+
mock_call_api(
|
76
|
+
subject,
|
77
|
+
[
|
78
|
+
{
|
79
|
+
method: 'PATCH',
|
80
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{subject_config[:natgateway_id]}",
|
81
|
+
operation: :'NATGatewaysApi.datacenters_natgateways_patch',
|
82
|
+
return_type: 'NatGateway',
|
83
|
+
body: {
|
84
|
+
name: subject_config[:name],
|
85
|
+
publicIps: subject_config[:ips].split(','),
|
86
|
+
lans: parsed_lans.map(&:to_hash),
|
87
|
+
},
|
88
|
+
result: natgateway,
|
89
|
+
},
|
90
|
+
{
|
91
|
+
method: 'GET',
|
92
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{subject_config[:natgateway_id]}",
|
93
|
+
operation: :'NATGatewaysApi.datacenters_natgateways_find_by_nat_gateway_id',
|
94
|
+
return_type: 'NatGateway',
|
95
|
+
result: natgateway,
|
96
|
+
},
|
97
|
+
],
|
98
|
+
)
|
99
|
+
|
100
|
+
expect { subject.run }.not_to raise_error(Exception)
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'should not make any call if any required option is missing' do
|
104
|
+
required_options = subject.instance_variable_get(:@required_options)
|
105
|
+
|
106
|
+
arrays_without_one_element(required_options).each do |test_case|
|
107
|
+
|
108
|
+
test_case[:array].each { |value| subject.config[value] = 'test' }
|
109
|
+
|
110
|
+
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
111
|
+
expect(subject.api_client).not_to receive(:call_api)
|
112
|
+
|
113
|
+
expect { subject.run }.to raise_error(SystemExit) do |error|
|
114
|
+
expect(error.status).to eq(1)
|
115
|
+
end
|
116
|
+
|
117
|
+
required_options.each { |value| subject.config[value] = nil }
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ionoscloud_networkloadbalancer_create'
|
3
|
+
|
4
|
+
Chef::Knife::IonoscloudNetworkloadbalancerCreate.load_deps
|
5
|
+
|
6
|
+
describe Chef::Knife::IonoscloudNetworkloadbalancerCreate do
|
7
|
+
before :each do
|
8
|
+
subject { Chef::Knife::IonoscloudNetworkloadbalancerCreate.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 NetworkLoadBalancersApi.datacenters_networkloadbalancers_post with the expected arguments and output based on what it receives' do
|
16
|
+
network_loadbalancer = network_loadbalancer_mock
|
17
|
+
subject_config = {
|
18
|
+
ionoscloud_username: 'email',
|
19
|
+
ionoscloud_password: 'password',
|
20
|
+
datacenter_id: 'datacenter_id',
|
21
|
+
name: network_loadbalancer.properties.name,
|
22
|
+
ips: network_loadbalancer.properties.ips.join(','),
|
23
|
+
listener_lan: network_loadbalancer.properties.listener_lan,
|
24
|
+
target_lan: network_loadbalancer.properties.target_lan,
|
25
|
+
lb_private_ips: network_loadbalancer.properties.lb_private_ips.join(','),
|
26
|
+
}.each do |key, value|
|
27
|
+
subject.config[key] = value
|
28
|
+
end
|
29
|
+
|
30
|
+
expect(subject).to receive(:puts).with("ID: #{network_loadbalancer.id}")
|
31
|
+
expect(subject).to receive(:puts).with("Name: #{network_loadbalancer.properties.name}")
|
32
|
+
expect(subject).to receive(:puts).with("Listener LAN: #{network_loadbalancer.properties.listener_lan}")
|
33
|
+
expect(subject).to receive(:puts).with("IPS: #{network_loadbalancer.properties.ips}")
|
34
|
+
expect(subject).to receive(:puts).with("Target LAN: #{network_loadbalancer.properties.target_lan}")
|
35
|
+
expect(subject).to receive(:puts).with("Private IPS: #{network_loadbalancer.properties.lb_private_ips}")
|
36
|
+
expect(subject).to receive(:puts).with("Forwarding Rules: #{network_loadbalancer.entities.forwardingrules.items.map do |rule|
|
37
|
+
{
|
38
|
+
id: rule.id,
|
39
|
+
name: rule.properties.name,
|
40
|
+
algorithm: rule.properties.algorithm,
|
41
|
+
protocol: rule.properties.protocol,
|
42
|
+
listener_ip: rule.properties.listener_ip,
|
43
|
+
listener_port: rule.properties.listener_port,
|
44
|
+
health_check: rule.properties.health_check.nil? ? nil : rule.properties.health_check.to_hash,
|
45
|
+
targets: (rule.properties.targets.nil? ? [] : rule.properties.targets.map { |target| target.to_hash }),
|
46
|
+
}
|
47
|
+
end}")
|
48
|
+
expect(subject).to receive(:puts).with("Flowlogs: #{network_loadbalancer.entities.flowlogs.items.map { |flowlog| flowlog.id }}")
|
49
|
+
|
50
|
+
mock_wait_for(subject)
|
51
|
+
mock_call_api(
|
52
|
+
subject,
|
53
|
+
[
|
54
|
+
{
|
55
|
+
method: 'POST',
|
56
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/networkloadbalancers",
|
57
|
+
operation: :'NetworkLoadBalancersApi.datacenters_networkloadbalancers_post',
|
58
|
+
return_type: 'NetworkLoadBalancer',
|
59
|
+
body: { properties: network_loadbalancer.properties.to_hash },
|
60
|
+
result: network_loadbalancer,
|
61
|
+
},
|
62
|
+
{
|
63
|
+
method: 'GET',
|
64
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/networkloadbalancers/#{network_loadbalancer.id}",
|
65
|
+
operation: :'NetworkLoadBalancersApi.datacenters_networkloadbalancers_find_by_network_load_balancer_id',
|
66
|
+
return_type: 'NetworkLoadBalancer',
|
67
|
+
result: network_loadbalancer,
|
68
|
+
},
|
69
|
+
],
|
70
|
+
)
|
71
|
+
|
72
|
+
expect { subject.run }.not_to raise_error(Exception)
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'should not make any call if any required option is missing' do
|
76
|
+
required_options = subject.instance_variable_get(:@required_options)
|
77
|
+
|
78
|
+
arrays_without_one_element(required_options).each do |test_case|
|
79
|
+
|
80
|
+
test_case[:array].each { |value| subject.config[value] = 'test' }
|
81
|
+
|
82
|
+
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
83
|
+
expect(subject.api_client).not_to receive(:call_api)
|
84
|
+
|
85
|
+
expect { subject.run }.to raise_error(SystemExit) do |error|
|
86
|
+
expect(error.status).to eq(1)
|
87
|
+
end
|
88
|
+
|
89
|
+
required_options.each { |value| subject.config[value] = nil }
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|