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
@@ -7,7 +7,7 @@ describe Chef::Knife::IonoscloudBackupunitSsourl do
|
|
7
7
|
subject { Chef::Knife::IonoscloudBackupunitSsourl.new }
|
8
8
|
|
9
9
|
describe '#run' do
|
10
|
-
it 'should call
|
10
|
+
it 'should call BackupUnitsApi.backupunits_ssourl_get and output the received url when the user ID is valid' do
|
11
11
|
backupunit = backupunit_mock
|
12
12
|
backupunit_sso = backupunit_sso_mock
|
13
13
|
subject_config = {
|
@@ -27,7 +27,7 @@ describe Chef::Knife::IonoscloudBackupunitSsourl do
|
|
27
27
|
{
|
28
28
|
method: 'GET',
|
29
29
|
path: "/backupunits/#{backupunit.id}/ssourl",
|
30
|
-
operation: :'
|
30
|
+
operation: :'BackupUnitsApi.backupunits_ssourl_get',
|
31
31
|
return_type: 'BackupUnitSSO',
|
32
32
|
result: backupunit_sso,
|
33
33
|
},
|
@@ -59,7 +59,7 @@ describe Chef::Knife::IonoscloudBackupunitSsourl do
|
|
59
59
|
{
|
60
60
|
method: 'GET',
|
61
61
|
path: "/backupunits/#{backupunit_id}/ssourl",
|
62
|
-
operation: :'
|
62
|
+
operation: :'BackupUnitsApi.backupunits_ssourl_get',
|
63
63
|
return_type: 'BackupUnitSSO',
|
64
64
|
exception: Ionoscloud::ApiError.new(code: 404),
|
65
65
|
},
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ionoscloud_backupunit_update'
|
3
|
+
|
4
|
+
Chef::Knife::IonoscloudBackupunitUpdate.load_deps
|
5
|
+
|
6
|
+
describe Chef::Knife::IonoscloudBackupunitUpdate do
|
7
|
+
before :each do
|
8
|
+
subject { Chef::Knife::IonoscloudBackupunitUpdate.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 BackupUnitsApi.backupunits_patch' do
|
16
|
+
backupunit = backupunit_mock
|
17
|
+
subject_config = {
|
18
|
+
ionoscloud_username: 'email',
|
19
|
+
ionoscloud_password: 'password',
|
20
|
+
backupunit_id: backupunit.id,
|
21
|
+
email: 'edited' + backupunit.properties.email,
|
22
|
+
password: 'password_edited',
|
23
|
+
yes: true,
|
24
|
+
}
|
25
|
+
|
26
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
27
|
+
|
28
|
+
|
29
|
+
expect(subject).to receive(:puts).with("ID: #{backupunit.id}")
|
30
|
+
expect(subject).to receive(:puts).with("Name: #{backupunit.properties.name}")
|
31
|
+
expect(subject).to receive(:puts).with("Email: #{subject_config[:email]}")
|
32
|
+
|
33
|
+
backupunit.properties.email = subject_config[:email]
|
34
|
+
|
35
|
+
mock_wait_for(subject)
|
36
|
+
mock_call_api(
|
37
|
+
subject,
|
38
|
+
[
|
39
|
+
{
|
40
|
+
method: 'PATCH',
|
41
|
+
path: "/backupunits/#{backupunit.id}",
|
42
|
+
operation: :'BackupUnitsApi.backupunits_patch',
|
43
|
+
return_type: 'BackupUnit',
|
44
|
+
body: { email: subject_config[:email], password: subject_config[:password] },
|
45
|
+
result: backupunit,
|
46
|
+
},
|
47
|
+
{
|
48
|
+
method: 'GET',
|
49
|
+
path: "/backupunits/#{backupunit.id}",
|
50
|
+
operation: :'BackupUnitsApi.backupunits_find_by_id',
|
51
|
+
return_type: 'BackupUnit',
|
52
|
+
result: backupunit,
|
53
|
+
},
|
54
|
+
],
|
55
|
+
)
|
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
|
@@ -27,7 +27,7 @@ describe Chef::Knife::IonoscloudBaseTest do
|
|
27
27
|
{
|
28
28
|
method: 'GET',
|
29
29
|
path: "/requests/#{request_id}/status",
|
30
|
-
operation: :'
|
30
|
+
operation: :'RequestsApi.requests_status_get',
|
31
31
|
return_type: 'RequestStatus',
|
32
32
|
result: request_status,
|
33
33
|
},
|
@@ -47,7 +47,7 @@ describe Chef::Knife::IonoscloudBaseTest do
|
|
47
47
|
{
|
48
48
|
method: 'GET',
|
49
49
|
path: "/requests/#{request_id}/status",
|
50
|
-
operation: :'
|
50
|
+
operation: :'RequestsApi.requests_status_get',
|
51
51
|
return_type: 'RequestStatus',
|
52
52
|
result: request_status,
|
53
53
|
},
|
@@ -67,7 +67,7 @@ describe Chef::Knife::IonoscloudBaseTest do
|
|
67
67
|
{
|
68
68
|
method: 'GET',
|
69
69
|
path: "/requests/#{request_id}/status",
|
70
|
-
operation: :'
|
70
|
+
operation: :'RequestsApi.requests_status_get',
|
71
71
|
return_type: 'RequestStatus',
|
72
72
|
result: request_status,
|
73
73
|
},
|
@@ -89,7 +89,7 @@ describe Chef::Knife::IonoscloudBaseTest do
|
|
89
89
|
{
|
90
90
|
method: 'GET',
|
91
91
|
path: "/requests/#{request_id}/status",
|
92
|
-
operation: :'
|
92
|
+
operation: :'RequestsApi.requests_status_get',
|
93
93
|
return_type: 'RequestStatus',
|
94
94
|
result: request_status,
|
95
95
|
},
|
@@ -12,7 +12,7 @@ describe Chef::Knife::IonoscloudCompositeServerCreate do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
describe '#run' do
|
15
|
-
it 'should call
|
15
|
+
it 'should call ServersApi.datacenters_servers_post with the expected arguments and output based on what it receives' do
|
16
16
|
server = server_mock({ volumes: Ionoscloud::Volumes.new(items: [volume_mock]), nics: Ionoscloud::Nics.new(items: [nic_mock]) })
|
17
17
|
subject_config = {
|
18
18
|
ionoscloud_username: 'email',
|
@@ -30,15 +30,16 @@ describe Chef::Knife::IonoscloudCompositeServerCreate do
|
|
30
30
|
type: server.entities.volumes.items.first.properties.type,
|
31
31
|
bus: server.entities.volumes.items.first.properties.bus,
|
32
32
|
volume_availability_zone: server.entities.volumes.items.first.properties.availability_zone,
|
33
|
-
|
34
|
-
|
33
|
+
image: server.entities.volumes.items.first.properties.image,
|
34
|
+
backupunit_id: server.entities.volumes.items.first.properties.backupunit_id,
|
35
|
+
user_data: server.entities.volumes.items.first.properties.user_data,
|
35
36
|
image_password: 'K3tTj8G14a3EgKyNeeiY',
|
36
37
|
|
37
38
|
lan: server.entities.nics.items.first.properties.lan,
|
38
39
|
nic_name: server.entities.nics.items.first.properties.name,
|
39
40
|
dhcp: server.entities.nics.items.first.properties.dhcp,
|
40
41
|
ips: server.entities.nics.items.first.properties.ips.join(','),
|
41
|
-
|
42
|
+
firewall_type: server.entities.nics.items.first.properties.firewall_type,
|
42
43
|
}
|
43
44
|
|
44
45
|
subject_config.each { |key, value| subject.config[key] = value }
|
@@ -56,13 +57,15 @@ describe Chef::Knife::IonoscloudCompositeServerCreate do
|
|
56
57
|
|
57
58
|
expected_entities = server.entities.to_hash
|
58
59
|
expected_entities[:volumes][:items][0].delete(:id)
|
59
|
-
expected_entities[:volumes][:items][0][:properties].delete(:image)
|
60
60
|
expected_entities[:nics][:items][0].delete(:id)
|
61
61
|
expected_entities[:nics][:items][0].delete(:entities)
|
62
62
|
expected_entities[:nics][:items][0][:properties].delete(:mac)
|
63
63
|
expected_entities[:nics][:items][0][:properties].delete(:firewallActive)
|
64
|
+
expected_entities[:nics][:items][0][:properties].delete(:deviceNumber)
|
65
|
+
expected_entities[:nics][:items][0][:properties].delete(:pciSlot)
|
64
66
|
|
65
|
-
expected_entities[:volumes][:items][0][:properties]
|
67
|
+
expected_entities[:volumes][:items][0][:properties].delete(:licenceType)
|
68
|
+
expected_entities[:volumes][:items][0][:properties][:image] = subject_config[:image]
|
66
69
|
expected_entities[:volumes][:items][0][:properties][:imagePassword] = subject_config[:image_password]
|
67
70
|
|
68
71
|
mock_wait_for(subject)
|
@@ -72,7 +75,7 @@ describe Chef::Knife::IonoscloudCompositeServerCreate do
|
|
72
75
|
{
|
73
76
|
method: 'POST',
|
74
77
|
path: "/datacenters/#{subject_config[:datacenter_id]}/servers",
|
75
|
-
operation: :'
|
78
|
+
operation: :'ServersApi.datacenters_servers_post',
|
76
79
|
return_type: 'Server',
|
77
80
|
body: { properties: expected_properties, entities: expected_entities },
|
78
81
|
result: server,
|
@@ -80,7 +83,7 @@ describe Chef::Knife::IonoscloudCompositeServerCreate do
|
|
80
83
|
{
|
81
84
|
method: 'GET',
|
82
85
|
path: "/datacenters/#{subject_config[:datacenter_id]}/servers/#{server.id}",
|
83
|
-
operation: :'
|
86
|
+
operation: :'ServersApi.datacenters_servers_find_by_id',
|
84
87
|
return_type: 'Server',
|
85
88
|
result: server,
|
86
89
|
},
|
@@ -12,8 +12,8 @@ describe Chef::Knife::IonoscloudContractList do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
describe '#run' do
|
15
|
-
it 'should call
|
16
|
-
|
15
|
+
it 'should call ContractResourcesApi.contracts_get' do
|
16
|
+
contracts = contracts_mock
|
17
17
|
subject_config = {
|
18
18
|
ionoscloud_username: 'email',
|
19
19
|
ionoscloud_password: 'password',
|
@@ -21,28 +21,33 @@ describe Chef::Knife::IonoscloudContractList do
|
|
21
21
|
|
22
22
|
subject_config.each { |key, value| subject.config[key] = value }
|
23
23
|
|
24
|
-
expect(subject).to receive(:puts).with("Contract Type: #{
|
25
|
-
expect(subject).to receive(:puts).with("Contract Owner: #{
|
26
|
-
expect(subject).to receive(:puts).with("Contract Number: #{
|
27
|
-
expect(subject).to receive(:puts).with("Registration Domain: #{
|
28
|
-
expect(subject).to receive(:puts).with("Status: #{
|
29
|
-
expect(subject).to receive(:puts).with("Cores per contract: #{
|
30
|
-
expect(subject).to receive(:puts).with("Cores per server: #{
|
31
|
-
expect(subject).to receive(:puts).with("Cores provisioned: #{
|
32
|
-
expect(subject).to receive(:puts).with("HDD limit per contract: #{
|
33
|
-
expect(subject).to receive(:puts).with("HDD limit per volume: #{
|
34
|
-
expect(subject).to receive(:puts).with("HDD volume provisioned: #{
|
35
|
-
expect(subject).to receive(:puts).with("RAM per contract: #{
|
36
|
-
expect(subject).to receive(:puts).with("RAM per server: #{
|
37
|
-
expect(subject).to receive(:puts).with("RAM provisioned: #{
|
38
|
-
expect(subject).to receive(:puts).with("Reservable IPs: #{
|
39
|
-
expect(subject).to receive(:puts).with("Reservable IPs in use: #{
|
40
|
-
expect(subject).to receive(:puts).with("Reservable IPs on contract: #{
|
41
|
-
expect(subject).to receive(:puts).with("SSD limit per contract: #{
|
42
|
-
expect(subject).to receive(:puts).with("SSD limit per volume: #{
|
43
|
-
expect(subject).to receive(:puts).with("SSD volume provisioned: #{
|
44
|
-
expect(subject).to receive(:puts).with("
|
45
|
-
expect(subject).to receive(:puts).with("K8s
|
24
|
+
expect(subject).to receive(:puts).with("Contract Type: #{contracts.items.first.type}")
|
25
|
+
expect(subject).to receive(:puts).with("Contract Owner: #{contracts.items.first.properties.owner}")
|
26
|
+
expect(subject).to receive(:puts).with("Contract Number: #{contracts.items.first.properties.contract_number}")
|
27
|
+
expect(subject).to receive(:puts).with("Registration Domain: #{contracts.items.first.properties.reg_domain}")
|
28
|
+
expect(subject).to receive(:puts).with("Status: #{contracts.items.first.properties.status}")
|
29
|
+
expect(subject).to receive(:puts).with("Cores per contract: #{contracts.items.first.properties.resource_limits.cores_per_contract}")
|
30
|
+
expect(subject).to receive(:puts).with("Cores per server: #{contracts.items.first.properties.resource_limits.cores_per_server}")
|
31
|
+
expect(subject).to receive(:puts).with("Cores provisioned: #{contracts.items.first.properties.resource_limits.cores_provisioned}")
|
32
|
+
expect(subject).to receive(:puts).with("HDD limit per contract: #{contracts.items.first.properties.resource_limits.hdd_limit_per_contract}")
|
33
|
+
expect(subject).to receive(:puts).with("HDD limit per volume: #{contracts.items.first.properties.resource_limits.hdd_limit_per_volume}")
|
34
|
+
expect(subject).to receive(:puts).with("HDD volume provisioned: #{contracts.items.first.properties.resource_limits.hdd_volume_provisioned}")
|
35
|
+
expect(subject).to receive(:puts).with("RAM per contract: #{contracts.items.first.properties.resource_limits.ram_per_contract}")
|
36
|
+
expect(subject).to receive(:puts).with("RAM per server: #{contracts.items.first.properties.resource_limits.ram_per_server}")
|
37
|
+
expect(subject).to receive(:puts).with("RAM provisioned: #{contracts.items.first.properties.resource_limits.ram_provisioned}")
|
38
|
+
expect(subject).to receive(:puts).with("Reservable IPs: #{contracts.items.first.properties.resource_limits.reservable_ips}")
|
39
|
+
expect(subject).to receive(:puts).with("Reservable IPs in use: #{contracts.items.first.properties.resource_limits.reserved_ips_in_use}")
|
40
|
+
expect(subject).to receive(:puts).with("Reservable IPs on contract: #{contracts.items.first.properties.resource_limits.reserved_ips_on_contract}")
|
41
|
+
expect(subject).to receive(:puts).with("SSD limit per contract: #{contracts.items.first.properties.resource_limits.ssd_limit_per_contract}")
|
42
|
+
expect(subject).to receive(:puts).with("SSD limit per volume: #{contracts.items.first.properties.resource_limits.ssd_limit_per_volume}")
|
43
|
+
expect(subject).to receive(:puts).with("SSD volume provisioned: #{contracts.items.first.properties.resource_limits.ssd_volume_provisioned}")
|
44
|
+
expect(subject).to receive(:puts).with("DAS volume provisioned: #{contracts.items.first.properties.resource_limits.das_volume_provisioned}")
|
45
|
+
expect(subject).to receive(:puts).with("K8s Cluster Limit Total: #{contracts.items.first.properties.resource_limits.k8s_cluster_limit_total}")
|
46
|
+
expect(subject).to receive(:puts).with("K8s Clusters provisioned: #{contracts.items.first.properties.resource_limits.k8s_clusters_provisioned}")
|
47
|
+
expect(subject).to receive(:puts).with("NLB total limit: #{contracts.items.first.properties.resource_limits.nlb_limit_total}")
|
48
|
+
expect(subject).to receive(:puts).with("NLBs provisioned: #{contracts.items.first.properties.resource_limits.nlb_provisioned}")
|
49
|
+
expect(subject).to receive(:puts).with("NAT gateway total limit: #{contracts.items.first.properties.resource_limits.nat_gateway_limit_total}")
|
50
|
+
expect(subject).to receive(:puts).with("NAT gateways provisioned: #{contracts.items.first.properties.resource_limits.nat_gateway_provisioned}")
|
46
51
|
|
47
52
|
mock_call_api(
|
48
53
|
subject,
|
@@ -50,9 +55,9 @@ describe Chef::Knife::IonoscloudContractList do
|
|
50
55
|
{
|
51
56
|
method: 'GET',
|
52
57
|
path: '/contracts',
|
53
|
-
operation: :'
|
54
|
-
return_type: '
|
55
|
-
result:
|
58
|
+
operation: :'ContractResourcesApi.contracts_get',
|
59
|
+
return_type: 'Contracts',
|
60
|
+
result: contracts,
|
56
61
|
},
|
57
62
|
],
|
58
63
|
)
|
@@ -0,0 +1,249 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ionoscloud_cube_server_create'
|
3
|
+
|
4
|
+
Chef::Knife::IonoscloudCubeServerCreate.load_deps
|
5
|
+
|
6
|
+
describe Chef::Knife::IonoscloudCubeServerCreate do
|
7
|
+
before :each do
|
8
|
+
subject { Chef::Knife::IonoscloudCubeServerCreate.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 ServersApi.datacenters_servers_post with the expected arguments and also make another call to set the boot_volume when set_boot is sent' do
|
16
|
+
template = template_mock
|
17
|
+
server = server_mock(
|
18
|
+
volumes: Ionoscloud::Volumes.new(items: [volume_mock(size: template.properties.storage_size, type: 'DAS')]),
|
19
|
+
nics: Ionoscloud::Nics.new(items: [nic_mock]),
|
20
|
+
ram: template.properties.ram,
|
21
|
+
cores: template.properties.cores,
|
22
|
+
boot_volume: nil,
|
23
|
+
boot_cdrom: Ionoscloud::ResourceReference.new({ id: nil }),
|
24
|
+
)
|
25
|
+
|
26
|
+
subject_config = {
|
27
|
+
ionoscloud_username: 'email',
|
28
|
+
ionoscloud_password: 'password',
|
29
|
+
datacenter_id: 'datacenter_id',
|
30
|
+
|
31
|
+
template: template.id,
|
32
|
+
name: server.properties.name,
|
33
|
+
cpu_family: server.properties.cpu_family,
|
34
|
+
availability_zone: server.properties.availability_zone,
|
35
|
+
|
36
|
+
volume_name: server.entities.volumes.items.first.properties.name,
|
37
|
+
type: server.entities.volumes.items.first.properties.type,
|
38
|
+
bus: server.entities.volumes.items.first.properties.bus,
|
39
|
+
image: SecureRandom.uuid,
|
40
|
+
image_password: 'K3tTj8G14a3EgKyNeeiY',
|
41
|
+
backupunit_id: server.entities.volumes.items.first.properties.backupunit_id,
|
42
|
+
user_data: server.entities.volumes.items.first.properties.user_data,
|
43
|
+
|
44
|
+
set_boot: true,
|
45
|
+
|
46
|
+
lan: server.entities.nics.items.first.properties.lan,
|
47
|
+
nic_name: server.entities.nics.items.first.properties.name,
|
48
|
+
dhcp: server.entities.nics.items.first.properties.dhcp,
|
49
|
+
ips: server.entities.nics.items.first.properties.ips.join(','),
|
50
|
+
firewall_type: server.entities.nics.items.first.properties.firewall_type,
|
51
|
+
}
|
52
|
+
|
53
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
54
|
+
|
55
|
+
expect(subject).to receive(:puts).with("ID: #{server.id}")
|
56
|
+
expect(subject).to receive(:puts).with("Name: #{server.properties.name}")
|
57
|
+
expect(subject).to receive(:puts).with("Type: #{server.properties.type}")
|
58
|
+
expect(subject).to receive(:puts).with("Cores: #{server.properties.cores}")
|
59
|
+
expect(subject).to receive(:puts).with("CPU Family: #{server.properties.cpu_family}")
|
60
|
+
expect(subject).to receive(:puts).with("Ram: #{server.properties.ram}")
|
61
|
+
expect(subject).to receive(:puts).with("Availability Zone: #{server.properties.availability_zone}")
|
62
|
+
expect(subject).to receive(:puts).with("Boot Volume: #{server.entities.volumes.items.first.id}")
|
63
|
+
expect(subject).to receive(:puts).with("Boot CDROM: ")
|
64
|
+
|
65
|
+
expected_properties = server.properties.to_hash
|
66
|
+
expected_properties.delete(:bootCdrom)
|
67
|
+
expected_properties.delete(:bootVolume)
|
68
|
+
expected_properties.delete(:cores)
|
69
|
+
expected_properties.delete(:ram)
|
70
|
+
expected_properties[:type] = 'CUBE'
|
71
|
+
expected_properties[:templateUuid] = template.id
|
72
|
+
|
73
|
+
expected_entities = server.entities.to_hash
|
74
|
+
expected_entities[:volumes][:items][0].delete(:id)
|
75
|
+
expected_entities[:volumes][:items][0][:properties].delete(:size)
|
76
|
+
expected_entities[:volumes][:items][0][:properties].delete(:availabilityZone)
|
77
|
+
expected_entities[:nics][:items][0].delete(:id)
|
78
|
+
expected_entities[:nics][:items][0].delete(:entities)
|
79
|
+
expected_entities[:nics][:items][0][:properties].delete(:mac)
|
80
|
+
expected_entities[:nics][:items][0][:properties].delete(:firewallActive)
|
81
|
+
expected_entities[:nics][:items][0][:properties].delete(:deviceNumber)
|
82
|
+
expected_entities[:nics][:items][0][:properties].delete(:pciSlot)
|
83
|
+
|
84
|
+
expected_entities[:volumes][:items][0][:properties].delete(:licenceType)
|
85
|
+
expected_entities[:volumes][:items][0][:properties][:image] = subject_config[:image]
|
86
|
+
expected_entities[:volumes][:items][0][:properties][:imagePassword] = subject_config[:image_password]
|
87
|
+
|
88
|
+
server.properties.boot_volume = Ionoscloud::ResourceReference.new({ id: server.entities.volumes.items.first.id })
|
89
|
+
|
90
|
+
mock_wait_for(subject)
|
91
|
+
mock_wait_for(subject)
|
92
|
+
mock_call_api(
|
93
|
+
subject,
|
94
|
+
[
|
95
|
+
{
|
96
|
+
method: 'POST',
|
97
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/servers",
|
98
|
+
operation: :'ServersApi.datacenters_servers_post',
|
99
|
+
return_type: 'Server',
|
100
|
+
body: { properties: expected_properties, entities: expected_entities },
|
101
|
+
result: server,
|
102
|
+
},
|
103
|
+
{
|
104
|
+
method: 'GET',
|
105
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/servers/#{server.id}",
|
106
|
+
operation: :'ServersApi.datacenters_servers_find_by_id',
|
107
|
+
return_type: 'Server',
|
108
|
+
result: server,
|
109
|
+
},
|
110
|
+
{
|
111
|
+
method: 'PATCH',
|
112
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/servers/#{server.id}",
|
113
|
+
operation: :'ServersApi.datacenters_servers_patch',
|
114
|
+
return_type: 'Server',
|
115
|
+
body: { bootVolume: { id: server.entities.volumes.items[0].id } },
|
116
|
+
result: server,
|
117
|
+
},
|
118
|
+
{
|
119
|
+
method: 'GET',
|
120
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/servers/#{server.id}",
|
121
|
+
operation: :'ServersApi.datacenters_servers_find_by_id',
|
122
|
+
return_type: 'Server',
|
123
|
+
result: server,
|
124
|
+
},
|
125
|
+
],
|
126
|
+
)
|
127
|
+
|
128
|
+
expect { subject.run }.not_to raise_error(Exception)
|
129
|
+
end
|
130
|
+
|
131
|
+
it 'should call ServersApi.datacenters_servers_post with the expected arguments and should not make another call to set the boot_volume when set_boot is not sent' do
|
132
|
+
template = template_mock
|
133
|
+
server = server_mock(
|
134
|
+
volumes: Ionoscloud::Volumes.new(items: [volume_mock(size: template.properties.storage_size, type: 'DAS')]),
|
135
|
+
nics: Ionoscloud::Nics.new(items: [nic_mock]),
|
136
|
+
ram: template.properties.ram,
|
137
|
+
cores: template.properties.cores,
|
138
|
+
boot_volume: nil,
|
139
|
+
boot_cdrom: Ionoscloud::ResourceReference.new({ id: nil }),
|
140
|
+
)
|
141
|
+
|
142
|
+
subject_config = {
|
143
|
+
ionoscloud_username: 'email',
|
144
|
+
ionoscloud_password: 'password',
|
145
|
+
datacenter_id: 'datacenter_id',
|
146
|
+
|
147
|
+
template: template.id,
|
148
|
+
name: server.properties.name,
|
149
|
+
cpu_family: server.properties.cpu_family,
|
150
|
+
availability_zone: server.properties.availability_zone,
|
151
|
+
|
152
|
+
volume_name: server.entities.volumes.items.first.properties.name,
|
153
|
+
type: server.entities.volumes.items.first.properties.type,
|
154
|
+
bus: server.entities.volumes.items.first.properties.bus,
|
155
|
+
image: SecureRandom.uuid,
|
156
|
+
image_password: 'K3tTj8G14a3EgKyNeeiY',
|
157
|
+
backupunit_id: server.entities.volumes.items.first.properties.backupunit_id,
|
158
|
+
user_data: server.entities.volumes.items.first.properties.user_data,
|
159
|
+
|
160
|
+
set_boot: false,
|
161
|
+
|
162
|
+
lan: server.entities.nics.items.first.properties.lan,
|
163
|
+
nic_name: server.entities.nics.items.first.properties.name,
|
164
|
+
dhcp: server.entities.nics.items.first.properties.dhcp,
|
165
|
+
ips: server.entities.nics.items.first.properties.ips.join(','),
|
166
|
+
firewall_type: server.entities.nics.items.first.properties.firewall_type,
|
167
|
+
}
|
168
|
+
|
169
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
170
|
+
|
171
|
+
expect(subject).to receive(:puts).with("ID: #{server.id}")
|
172
|
+
expect(subject).to receive(:puts).with("Name: #{server.properties.name}")
|
173
|
+
expect(subject).to receive(:puts).with("Type: #{server.properties.type}")
|
174
|
+
expect(subject).to receive(:puts).with("Cores: #{server.properties.cores}")
|
175
|
+
expect(subject).to receive(:puts).with("CPU Family: #{server.properties.cpu_family}")
|
176
|
+
expect(subject).to receive(:puts).with("Ram: #{server.properties.ram}")
|
177
|
+
expect(subject).to receive(:puts).with("Availability Zone: #{server.properties.availability_zone}")
|
178
|
+
expect(subject).to receive(:puts).with("Boot Volume: #{server.entities.volumes.items.first.id}")
|
179
|
+
expect(subject).to receive(:puts).with("Boot CDROM: ")
|
180
|
+
|
181
|
+
expected_properties = server.properties.to_hash
|
182
|
+
expected_properties.delete(:bootCdrom)
|
183
|
+
expected_properties.delete(:bootVolume)
|
184
|
+
expected_properties.delete(:cores)
|
185
|
+
expected_properties.delete(:ram)
|
186
|
+
expected_properties[:type] = 'CUBE'
|
187
|
+
expected_properties[:templateUuid] = template.id
|
188
|
+
|
189
|
+
expected_entities = server.entities.to_hash
|
190
|
+
expected_entities[:volumes][:items][0].delete(:id)
|
191
|
+
expected_entities[:volumes][:items][0][:properties].delete(:size)
|
192
|
+
expected_entities[:volumes][:items][0][:properties].delete(:availabilityZone)
|
193
|
+
expected_entities[:nics][:items][0].delete(:id)
|
194
|
+
expected_entities[:nics][:items][0].delete(:entities)
|
195
|
+
expected_entities[:nics][:items][0][:properties].delete(:mac)
|
196
|
+
expected_entities[:nics][:items][0][:properties].delete(:firewallActive)
|
197
|
+
expected_entities[:nics][:items][0][:properties].delete(:deviceNumber)
|
198
|
+
expected_entities[:nics][:items][0][:properties].delete(:pciSlot)
|
199
|
+
|
200
|
+
expected_entities[:volumes][:items][0][:properties].delete(:licenceType)
|
201
|
+
expected_entities[:volumes][:items][0][:properties][:image] = subject_config[:image]
|
202
|
+
expected_entities[:volumes][:items][0][:properties][:imagePassword] = subject_config[:image_password]
|
203
|
+
|
204
|
+
server.properties.boot_volume = Ionoscloud::ResourceReference.new({ id: server.entities.volumes.items.first.id })
|
205
|
+
|
206
|
+
mock_wait_for(subject)
|
207
|
+
mock_call_api(
|
208
|
+
subject,
|
209
|
+
[
|
210
|
+
{
|
211
|
+
method: 'POST',
|
212
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/servers",
|
213
|
+
operation: :'ServersApi.datacenters_servers_post',
|
214
|
+
return_type: 'Server',
|
215
|
+
body: { properties: expected_properties, entities: expected_entities },
|
216
|
+
result: server,
|
217
|
+
},
|
218
|
+
{
|
219
|
+
method: 'GET',
|
220
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/servers/#{server.id}",
|
221
|
+
operation: :'ServersApi.datacenters_servers_find_by_id',
|
222
|
+
return_type: 'Server',
|
223
|
+
result: server,
|
224
|
+
},
|
225
|
+
],
|
226
|
+
)
|
227
|
+
|
228
|
+
expect { subject.run }.not_to raise_error(Exception)
|
229
|
+
end
|
230
|
+
|
231
|
+
it 'should not make any call if any required option is missing' do
|
232
|
+
required_options = subject.instance_variable_get(:@required_options)
|
233
|
+
|
234
|
+
arrays_without_one_element(required_options).each do |test_case|
|
235
|
+
|
236
|
+
test_case[:array].each { |value| subject.config[value] = 'test' }
|
237
|
+
|
238
|
+
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
239
|
+
expect(subject.api_client).not_to receive(:call_api)
|
240
|
+
|
241
|
+
expect { subject.run }.to raise_error(SystemExit) do |error|
|
242
|
+
expect(error.status).to eq(1)
|
243
|
+
end
|
244
|
+
|
245
|
+
required_options.each { |value| subject.config[value] = nil }
|
246
|
+
end
|
247
|
+
end
|
248
|
+
end
|
249
|
+
end
|
@@ -12,7 +12,7 @@ describe Chef::Knife::IonoscloudDatacenterCreate do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
describe '#run' do
|
15
|
-
it 'should call
|
15
|
+
it 'should call DataCentersApi.datacenters_post with the expected arguments and output based on what it receives' do
|
16
16
|
datacenter = datacenter_mock
|
17
17
|
subject_config = {
|
18
18
|
ionoscloud_username: 'email',
|
@@ -29,9 +29,13 @@ describe Chef::Knife::IonoscloudDatacenterCreate do
|
|
29
29
|
expect(subject).to receive(:puts).with("Name: #{datacenter.properties.name}")
|
30
30
|
expect(subject).to receive(:puts).with("Description: #{datacenter.properties.description}")
|
31
31
|
expect(subject).to receive(:puts).with("Location: #{datacenter.properties.location}")
|
32
|
+
expect(subject).to receive(:puts).with("Version: #{datacenter.properties.version}")
|
33
|
+
expect(subject).to receive(:puts).with("Features: #{datacenter.properties.features}")
|
34
|
+
expect(subject).to receive(:puts).with("Sec Auth Protection: #{datacenter.properties.sec_auth_protection}")
|
32
35
|
|
33
36
|
expected_body = datacenter.properties.to_hash
|
34
37
|
expected_body.delete(:version)
|
38
|
+
expected_body.delete(:cpuArchitecture)
|
35
39
|
|
36
40
|
mock_wait_for(subject)
|
37
41
|
mock_call_api(
|
@@ -40,7 +44,7 @@ describe Chef::Knife::IonoscloudDatacenterCreate do
|
|
40
44
|
{
|
41
45
|
method: 'POST',
|
42
46
|
path: '/datacenters',
|
43
|
-
operation: :'
|
47
|
+
operation: :'DataCentersApi.datacenters_post',
|
44
48
|
return_type: 'Datacenter',
|
45
49
|
body: { properties: expected_body },
|
46
50
|
result: datacenter,
|
@@ -12,7 +12,7 @@ describe Chef::Knife::IonoscloudDatacenterDelete do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
describe '#run' do
|
15
|
-
it 'should call
|
15
|
+
it 'should call DataCentersApi.datacenters_delete when the ID is valid' do
|
16
16
|
datacenter = datacenter_mock
|
17
17
|
subject_config = {
|
18
18
|
ionoscloud_username: 'email',
|
@@ -27,6 +27,9 @@ describe Chef::Knife::IonoscloudDatacenterDelete do
|
|
27
27
|
expect(subject).to receive(:puts).with("Name: #{datacenter.properties.name}")
|
28
28
|
expect(subject).to receive(:puts).with("Description: #{datacenter.properties.description}")
|
29
29
|
expect(subject).to receive(:puts).with("Location: #{datacenter.properties.location}")
|
30
|
+
expect(subject).to receive(:puts).with("Version: #{datacenter.properties.version}")
|
31
|
+
expect(subject).to receive(:puts).with("Features: #{datacenter.properties.features}")
|
32
|
+
expect(subject).to receive(:puts).with("Sec Auth Protection: #{datacenter.properties.sec_auth_protection}")
|
30
33
|
expect(subject.ui).to receive(:warn).with("Deleted Data center #{datacenter.id}. Request ID: ")
|
31
34
|
|
32
35
|
expect(subject.api_client).not_to receive(:wait_for)
|
@@ -37,14 +40,14 @@ describe Chef::Knife::IonoscloudDatacenterDelete do
|
|
37
40
|
{
|
38
41
|
method: 'GET',
|
39
42
|
path: "/datacenters/#{datacenter.id}",
|
40
|
-
operation: :'
|
43
|
+
operation: :'DataCentersApi.datacenters_find_by_id',
|
41
44
|
return_type: 'Datacenter',
|
42
45
|
result: datacenter,
|
43
46
|
},
|
44
47
|
{
|
45
48
|
method: 'DELETE',
|
46
49
|
path: "/datacenters/#{datacenter.id}",
|
47
|
-
operation: :'
|
50
|
+
operation: :'DataCentersApi.datacenters_delete',
|
48
51
|
},
|
49
52
|
],
|
50
53
|
)
|
@@ -52,7 +55,7 @@ describe Chef::Knife::IonoscloudDatacenterDelete do
|
|
52
55
|
expect { subject.run }.not_to raise_error(Exception)
|
53
56
|
end
|
54
57
|
|
55
|
-
it 'should not call
|
58
|
+
it 'should not call DataCentersApi.datacenters_delete when the user ID is not valid' do
|
56
59
|
datacenter_id = 'invalid_id'
|
57
60
|
subject_config = {
|
58
61
|
ionoscloud_username: 'email',
|
@@ -71,7 +74,7 @@ describe Chef::Knife::IonoscloudDatacenterDelete do
|
|
71
74
|
{
|
72
75
|
method: 'GET',
|
73
76
|
path: "/datacenters/#{datacenter_id}",
|
74
|
-
operation: :'
|
77
|
+
operation: :'DataCentersApi.datacenters_find_by_id',
|
75
78
|
return_type: 'Datacenter',
|
76
79
|
exception: Ionoscloud::ApiError.new(code: 404),
|
77
80
|
},
|