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
@@ -12,7 +12,7 @@ describe Chef::Knife::IonoscloudSnapshotRestore do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
describe '#run' do
|
15
|
-
it 'should call
|
15
|
+
it 'should call VolumesApi.datacenters_volumes_create_snapshot_post with the expected arguments and output based on what it receives' do
|
16
16
|
snapshot = snapshot_mock
|
17
17
|
volume = volume_mock
|
18
18
|
subject_config = {
|
@@ -32,7 +32,16 @@ describe Chef::Knife::IonoscloudSnapshotRestore do
|
|
32
32
|
expect(subject).to receive(:puts).with("Image: #{volume.properties.image}")
|
33
33
|
expect(subject).to receive(:puts).with("Type: #{volume.properties.type}")
|
34
34
|
expect(subject).to receive(:puts).with("Licence Type: #{volume.properties.licence_type}")
|
35
|
+
expect(subject).to receive(:puts).with("Backupunit ID: #{volume.properties.backupunit_id}")
|
36
|
+
expect(subject).to receive(:puts).with("User Data: #{volume.properties.user_data}")
|
35
37
|
expect(subject).to receive(:puts).with("Zone: #{volume.properties.availability_zone}")
|
38
|
+
expect(subject).to receive(:puts).with("CPU Hot Plug: #{volume.properties.cpu_hot_plug}")
|
39
|
+
expect(subject).to receive(:puts).with("RAM Hot Plug: #{volume.properties.ram_hot_plug}")
|
40
|
+
expect(subject).to receive(:puts).with("NIC Hot Plug: #{volume.properties.nic_hot_plug}")
|
41
|
+
expect(subject).to receive(:puts).with("NIC Hot Unplug: #{volume.properties.nic_hot_unplug}")
|
42
|
+
expect(subject).to receive(:puts).with("Disc Virtio Hot Plug: #{volume.properties.disc_virtio_hot_plug}")
|
43
|
+
expect(subject).to receive(:puts).with("Disc Virtio Hot Unplug: #{volume.properties.disc_virtio_hot_unplug}")
|
44
|
+
expect(subject).to receive(:puts).with("Device number: #{volume.properties.device_number}")
|
36
45
|
|
37
46
|
mock_wait_for(subject)
|
38
47
|
mock_call_api(
|
@@ -41,13 +50,13 @@ describe Chef::Knife::IonoscloudSnapshotRestore do
|
|
41
50
|
{
|
42
51
|
method: 'POST',
|
43
52
|
path: "/datacenters/#{subject_config[:datacenter_id]}/volumes/#{volume.id}/restore-snapshot",
|
44
|
-
operation: :'
|
53
|
+
operation: :'VolumesApi.datacenters_volumes_restore_snapshot_post',
|
45
54
|
form_params: { 'snapshotId' => snapshot.id },
|
46
55
|
},
|
47
56
|
{
|
48
57
|
method: 'GET',
|
49
58
|
path: "/datacenters/#{subject_config[:datacenter_id]}/volumes/#{volume.id}",
|
50
|
-
operation: :'
|
59
|
+
operation: :'VolumesApi.datacenters_volumes_find_by_id',
|
51
60
|
return_type: 'Volume',
|
52
61
|
result: volume,
|
53
62
|
},
|
@@ -0,0 +1,113 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ionoscloud_snapshot_update'
|
3
|
+
|
4
|
+
Chef::Knife::IonoscloudSnapshotUpdate.load_deps
|
5
|
+
|
6
|
+
describe Chef::Knife::IonoscloudSnapshotUpdate do
|
7
|
+
before :each do
|
8
|
+
subject { Chef::Knife::IonoscloudSnapshotUpdate.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 SnapshotsApi.datacenters_snapshots_patch' do
|
16
|
+
snapshot = snapshot_mock
|
17
|
+
subject_config = {
|
18
|
+
ionoscloud_username: 'email',
|
19
|
+
ionoscloud_password: 'password',
|
20
|
+
snapshot_id: snapshot.id,
|
21
|
+
name: snapshot.properties.name + '_edited',
|
22
|
+
description: snapshot.properties.description + '_edited',
|
23
|
+
licence_type: 'WINDOWS',
|
24
|
+
cpu_hot_plug: (!snapshot.properties.cpu_hot_plug).to_s,
|
25
|
+
ram_hot_plug: (!snapshot.properties.ram_hot_plug).to_s,
|
26
|
+
disc_virtio_hot_plug: (!snapshot.properties.disc_virtio_hot_plug).to_s,
|
27
|
+
disc_virtio_hot_unplug: (!snapshot.properties.disc_virtio_hot_unplug).to_s,
|
28
|
+
disc_scsi_hot_plug: (!snapshot.properties.disc_scsi_hot_plug).to_s,
|
29
|
+
yes: true,
|
30
|
+
}
|
31
|
+
|
32
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
33
|
+
|
34
|
+
expect(subject).to receive(:puts).with("ID: #{snapshot.id}")
|
35
|
+
expect(subject).to receive(:puts).with("Name: #{subject_config[:name]}")
|
36
|
+
expect(subject).to receive(:puts).with("Description: #{subject_config[:description]}")
|
37
|
+
expect(subject).to receive(:puts).with("Location: #{snapshot.properties.location}")
|
38
|
+
expect(subject).to receive(:puts).with("Size: #{snapshot.properties.size.to_s}")
|
39
|
+
expect(subject).to receive(:puts).with("Sec Auth Protection: #{snapshot.properties.sec_auth_protection}")
|
40
|
+
expect(subject).to receive(:puts).with("License Type: #{subject_config[:licence_type]}")
|
41
|
+
expect(subject).to receive(:puts).with("CPU Hot Plug: #{subject_config[:cpu_hot_plug]}")
|
42
|
+
expect(subject).to receive(:puts).with("CPU Hot Unplug: #{snapshot.properties.cpu_hot_unplug}")
|
43
|
+
expect(subject).to receive(:puts).with("RAM Hot Plug: #{subject_config[:ram_hot_plug]}")
|
44
|
+
expect(subject).to receive(:puts).with("RAM Hot Unplug: #{snapshot.properties.ram_hot_unplug}")
|
45
|
+
expect(subject).to receive(:puts).with("NIC Hot Plug: #{snapshot.properties.nic_hot_plug}")
|
46
|
+
expect(subject).to receive(:puts).with("NIC Hot Unplug: #{snapshot.properties.nic_hot_unplug}")
|
47
|
+
expect(subject).to receive(:puts).with("Disc Virtio Hot Plug: #{subject_config[:disc_virtio_hot_plug]}")
|
48
|
+
expect(subject).to receive(:puts).with("Disc Virtio Hot Unplug: #{subject_config[:disc_virtio_hot_unplug]}")
|
49
|
+
expect(subject).to receive(:puts).with("Disc Scsi Hot Plug: #{subject_config[:disc_scsi_hot_plug]}")
|
50
|
+
expect(subject).to receive(:puts).with("Disc Scsi Hot Unplug: #{snapshot.properties.disc_scsi_hot_unplug}")
|
51
|
+
|
52
|
+
snapshot.properties.name = subject_config[:name]
|
53
|
+
snapshot.properties.description = subject_config[:description]
|
54
|
+
snapshot.properties.licence_type = subject_config[:licence_type]
|
55
|
+
snapshot.properties.cpu_hot_plug = subject_config[:cpu_hot_plug].to_s.downcase == 'true'
|
56
|
+
snapshot.properties.ram_hot_plug = subject_config[:ram_hot_plug].to_s.downcase == 'true'
|
57
|
+
snapshot.properties.disc_virtio_hot_plug = subject_config[:disc_virtio_hot_plug].to_s.downcase == 'true'
|
58
|
+
snapshot.properties.disc_virtio_hot_unplug = subject_config[:disc_virtio_hot_unplug].to_s.downcase == 'true'
|
59
|
+
snapshot.properties.disc_scsi_hot_plug = subject_config[:disc_scsi_hot_plug].to_s.downcase == 'true'
|
60
|
+
|
61
|
+
mock_wait_for(subject)
|
62
|
+
mock_call_api(
|
63
|
+
subject,
|
64
|
+
[
|
65
|
+
{
|
66
|
+
method: 'PATCH',
|
67
|
+
path: "/snapshots/#{subject_config[:snapshot_id]}",
|
68
|
+
operation: :'SnapshotsApi.snapshots_patch',
|
69
|
+
return_type: 'Snapshot',
|
70
|
+
body: {
|
71
|
+
name: subject_config[:name],
|
72
|
+
description: subject_config[:description],
|
73
|
+
licenceType: subject_config[:licence_type],
|
74
|
+
cpuHotPlug: subject_config[:cpu_hot_plug].to_s.downcase == 'true',
|
75
|
+
ramHotPlug: subject_config[:ram_hot_plug].to_s.downcase == 'true',
|
76
|
+
discVirtioHotPlug: subject_config[:disc_virtio_hot_plug].to_s.downcase == 'true',
|
77
|
+
discVirtioHotUnplug: subject_config[:disc_virtio_hot_unplug].to_s.downcase == 'true',
|
78
|
+
discScsiHotPlug: subject_config[:disc_scsi_hot_plug].to_s.downcase == 'true',
|
79
|
+
},
|
80
|
+
result: snapshot,
|
81
|
+
},
|
82
|
+
{
|
83
|
+
method: 'GET',
|
84
|
+
path: "/snapshots/#{subject_config[:snapshot_id]}",
|
85
|
+
operation: :'SnapshotsApi.snapshots_find_by_id',
|
86
|
+
return_type: 'Snapshot',
|
87
|
+
result: snapshot,
|
88
|
+
},
|
89
|
+
],
|
90
|
+
)
|
91
|
+
|
92
|
+
expect { subject.run }.not_to raise_error(Exception)
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'should not make any call if any required option is missing' do
|
96
|
+
required_options = subject.instance_variable_get(:@required_options)
|
97
|
+
|
98
|
+
arrays_without_one_element(required_options).each do |test_case|
|
99
|
+
|
100
|
+
test_case[:array].each { |value| subject.config[value] = 'test' }
|
101
|
+
|
102
|
+
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
103
|
+
expect(subject.api_client).not_to receive(:call_api)
|
104
|
+
|
105
|
+
expect { subject.run }.to raise_error(SystemExit) do |error|
|
106
|
+
expect(error.status).to eq(1)
|
107
|
+
end
|
108
|
+
|
109
|
+
required_options.each { |value| subject.config[value] = nil }
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ionoscloud_template_list'
|
3
|
+
|
4
|
+
Chef::Knife::IonoscloudTemplateList.load_deps
|
5
|
+
|
6
|
+
describe Chef::Knife::IonoscloudTemplateList do
|
7
|
+
before :each do
|
8
|
+
subject { Chef::Knife::IonoscloudTemplateList.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 TemplatesApi.templates_get' do
|
16
|
+
templates = templates_mock
|
17
|
+
subject_config = {
|
18
|
+
ionoscloud_username: 'email',
|
19
|
+
ionoscloud_password: 'password',
|
20
|
+
}
|
21
|
+
|
22
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
23
|
+
|
24
|
+
template_list = [
|
25
|
+
subject.ui.color('ID', :bold),
|
26
|
+
subject.ui.color('Name', :bold),
|
27
|
+
subject.ui.color('Cores', :bold),
|
28
|
+
subject.ui.color('RAM', :bold),
|
29
|
+
subject.ui.color('Storage Size', :bold),
|
30
|
+
templates.items[0].id,
|
31
|
+
templates.items[0].properties.name,
|
32
|
+
Integer(templates.items[0].properties.cores),
|
33
|
+
Integer(templates.items[0].properties.ram),
|
34
|
+
Integer(templates.items[0].properties.storage_size),
|
35
|
+
templates.items[1].id,
|
36
|
+
templates.items[1].properties.name,
|
37
|
+
Integer(templates.items[1].properties.cores),
|
38
|
+
Integer(templates.items[1].properties.ram),
|
39
|
+
Integer(templates.items[1].properties.storage_size),
|
40
|
+
]
|
41
|
+
|
42
|
+
expect(subject.ui).to receive(:list).with(template_list, :uneven_columns_across, 5)
|
43
|
+
|
44
|
+
mock_call_api(
|
45
|
+
subject,
|
46
|
+
[
|
47
|
+
{
|
48
|
+
method: 'GET',
|
49
|
+
path: '/templates',
|
50
|
+
operation: :'TemplatesApi.templates_get',
|
51
|
+
return_type: 'Templates',
|
52
|
+
result: templates,
|
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
|
@@ -32,7 +32,9 @@ describe Chef::Knife::IonoscloudUserCreate do
|
|
32
32
|
expect(subject).to receive(:puts).with("Lastname: #{user.properties.lastname}")
|
33
33
|
expect(subject).to receive(:puts).with("Email: #{user.properties.email}")
|
34
34
|
expect(subject).to receive(:puts).with("Administrator: #{user.properties.administrator}")
|
35
|
-
expect(subject).to receive(:puts).with("2-Factor Auth: #{user.properties.force_sec_auth}")
|
35
|
+
expect(subject).to receive(:puts).with("Force 2-Factor Auth: #{user.properties.force_sec_auth}")
|
36
|
+
expect(subject).to receive(:puts).with("2-Factor Auth Active: #{user.properties.sec_auth_active}")
|
37
|
+
expect(subject).to receive(:puts).with("Active: #{user.properties.active}")
|
36
38
|
|
37
39
|
mock_wait_for(subject)
|
38
40
|
mock_call_api(
|
@@ -27,8 +27,10 @@ describe Chef::Knife::IonoscloudUserDelete do
|
|
27
27
|
expect(subject).to receive(:puts).with("Firstname: #{user.properties.firstname}")
|
28
28
|
expect(subject).to receive(:puts).with("Lastname: #{user.properties.lastname}")
|
29
29
|
expect(subject).to receive(:puts).with("Email: #{user.properties.email}")
|
30
|
-
expect(subject).to receive(:puts).with("Administrator: #{user.properties.administrator
|
31
|
-
expect(subject).to receive(:puts).with("2-Factor Auth: #{user.properties.force_sec_auth
|
30
|
+
expect(subject).to receive(:puts).with("Administrator: #{user.properties.administrator}")
|
31
|
+
expect(subject).to receive(:puts).with("Force 2-Factor Auth: #{user.properties.force_sec_auth}")
|
32
|
+
expect(subject).to receive(:puts).with("2-Factor Auth Active: #{user.properties.sec_auth_active}")
|
33
|
+
expect(subject).to receive(:puts).with("Active: #{user.properties.active}")
|
32
34
|
expect(subject.ui).to receive(:warn).with("Deleted User #{user.id}. Request ID: ")
|
33
35
|
|
34
36
|
expect(subject.api_client).not_to receive(:wait_for)
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ionoscloud_user_get'
|
3
|
+
|
4
|
+
Chef::Knife::IonoscloudUserGet.load_deps
|
5
|
+
|
6
|
+
describe Chef::Knife::IonoscloudUserGet do
|
7
|
+
before :each do
|
8
|
+
subject { Chef::Knife::IonoscloudUserGet.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 UserApi.users_find_by_id' do
|
16
|
+
user = user_mock
|
17
|
+
subject_config = {
|
18
|
+
ionoscloud_username: 'email',
|
19
|
+
ionoscloud_password: 'password',
|
20
|
+
user_id: user.id,
|
21
|
+
yes: true,
|
22
|
+
}
|
23
|
+
|
24
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
25
|
+
|
26
|
+
expect(subject).to receive(:puts).with("ID: #{user.id}")
|
27
|
+
expect(subject).to receive(:puts).with("Firstname: #{user.properties.firstname}")
|
28
|
+
expect(subject).to receive(:puts).with("Lastname: #{user.properties.lastname}")
|
29
|
+
expect(subject).to receive(:puts).with("Email: #{user.properties.email}")
|
30
|
+
expect(subject).to receive(:puts).with("Administrator: #{user.properties.administrator}")
|
31
|
+
expect(subject).to receive(:puts).with("Force 2-Factor Auth: #{user.properties.force_sec_auth}")
|
32
|
+
expect(subject).to receive(:puts).with("2-Factor Auth Active: #{user.properties.sec_auth_active}")
|
33
|
+
expect(subject).to receive(:puts).with("Active: #{user.properties.active}")
|
34
|
+
|
35
|
+
expect(subject.api_client).not_to receive(:wait_for)
|
36
|
+
mock_call_api(
|
37
|
+
subject,
|
38
|
+
[
|
39
|
+
{
|
40
|
+
method: 'GET',
|
41
|
+
path: "/um/users/#{subject_config[:user_id]}",
|
42
|
+
operation: :'UserManagementApi.um_users_find_by_id',
|
43
|
+
return_type: 'User',
|
44
|
+
result: user,
|
45
|
+
},
|
46
|
+
],
|
47
|
+
)
|
48
|
+
|
49
|
+
expect { subject.run }.not_to raise_error(Exception)
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'should not make any call if any required option is missing' do
|
53
|
+
required_options = subject.instance_variable_get(:@required_options)
|
54
|
+
|
55
|
+
arrays_without_one_element(required_options).each do |test_case|
|
56
|
+
|
57
|
+
test_case[:array].each { |value| subject.config[value] = 'test' }
|
58
|
+
|
59
|
+
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
60
|
+
expect(subject.api_client).not_to receive(:call_api)
|
61
|
+
|
62
|
+
expect { subject.run }.to raise_error(SystemExit) do |error|
|
63
|
+
expect(error.status).to eq(1)
|
64
|
+
end
|
65
|
+
|
66
|
+
required_options.each { |value| subject.config[value] = nil }
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -7,7 +7,7 @@ describe Chef::Knife::IonoscloudUserSsourl do
|
|
7
7
|
subject { Chef::Knife::IonoscloudUserSsourl.new }
|
8
8
|
|
9
9
|
describe '#run' do
|
10
|
-
it 'should call
|
10
|
+
it 'should call UserS3KeysApi.um_users_ssourl_get and output the received url when the user ID is valid' do
|
11
11
|
user = user_mock
|
12
12
|
sso_url = sso_url_mock
|
13
13
|
subject_config = {
|
@@ -27,7 +27,7 @@ describe Chef::Knife::IonoscloudUserSsourl do
|
|
27
27
|
{
|
28
28
|
method: 'GET',
|
29
29
|
path: "/um/users/#{user.id}/s3ssourl",
|
30
|
-
operation: :'
|
30
|
+
operation: :'UserS3KeysApi.um_users_s3ssourl_get',
|
31
31
|
return_type: 'S3ObjectStorageSSO',
|
32
32
|
result: sso_url,
|
33
33
|
},
|
@@ -59,7 +59,7 @@ describe Chef::Knife::IonoscloudUserSsourl do
|
|
59
59
|
{
|
60
60
|
method: 'GET',
|
61
61
|
path: "/um/users/#{user_id}/s3ssourl",
|
62
|
-
operation: :'
|
62
|
+
operation: :'UserS3KeysApi.um_users_s3ssourl_get',
|
63
63
|
return_type: 'S3ObjectStorageSSO',
|
64
64
|
exception: Ionoscloud::ApiError.new(code: 404),
|
65
65
|
},
|
@@ -0,0 +1,110 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ionoscloud_user_update'
|
3
|
+
|
4
|
+
Chef::Knife::IonoscloudUserUpdate.load_deps
|
5
|
+
|
6
|
+
describe Chef::Knife::IonoscloudUserUpdate do
|
7
|
+
before :each do
|
8
|
+
subject { Chef::Knife::IonoscloudUserUpdate.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 UserManagementApi.um_groups_users_put' do
|
16
|
+
user = user_mock
|
17
|
+
subject_config = {
|
18
|
+
ionoscloud_username: 'email',
|
19
|
+
ionoscloud_password: 'password',
|
20
|
+
user_id: user.id,
|
21
|
+
firstname: user.properties.firstname + '_edited',
|
22
|
+
lastname: user.properties.lastname + '_edited',
|
23
|
+
email: user.properties.email + '_edited',
|
24
|
+
administrator: (!user.properties.administrator).to_s,
|
25
|
+
force_sec_auth: (!user.properties.force_sec_auth).to_s,
|
26
|
+
sec_auth_active: (!user.properties.sec_auth_active).to_s,
|
27
|
+
active: (!user.properties.active).to_s,
|
28
|
+
yes: true,
|
29
|
+
}
|
30
|
+
|
31
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
32
|
+
|
33
|
+
expect(subject).to receive(:puts).with("ID: #{user.id}")
|
34
|
+
expect(subject).to receive(:puts).with("Firstname: #{subject_config[:firstname]}")
|
35
|
+
expect(subject).to receive(:puts).with("Lastname: #{subject_config[:lastname]}")
|
36
|
+
expect(subject).to receive(:puts).with("Email: #{subject_config[:email]}")
|
37
|
+
expect(subject).to receive(:puts).with("Administrator: #{subject_config[:administrator]}")
|
38
|
+
expect(subject).to receive(:puts).with("Force 2-Factor Auth: #{subject_config[:force_sec_auth]}")
|
39
|
+
expect(subject).to receive(:puts).with("2-Factor Auth Active: #{subject_config[:sec_auth_active]}")
|
40
|
+
expect(subject).to receive(:puts).with("Active: #{subject_config[:active]}")
|
41
|
+
|
42
|
+
user.properties.firstname = subject_config[:firstname]
|
43
|
+
user.properties.lastname = subject_config[:lastname]
|
44
|
+
user.properties.email = subject_config[:email]
|
45
|
+
user.properties.administrator = subject_config[:administrator].to_s.downcase == 'true'
|
46
|
+
user.properties.force_sec_auth = subject_config[:force_sec_auth].to_s.downcase == 'true'
|
47
|
+
user.properties.sec_auth_active = subject_config[:sec_auth_active].to_s.downcase == 'true'
|
48
|
+
user.properties.active = subject_config[:active].to_s.downcase == 'true'
|
49
|
+
|
50
|
+
mock_wait_for(subject)
|
51
|
+
mock_call_api(
|
52
|
+
subject,
|
53
|
+
[
|
54
|
+
{
|
55
|
+
method: 'GET',
|
56
|
+
path: "/um/users/#{subject_config[:user_id]}",
|
57
|
+
operation: :'UserManagementApi.um_users_find_by_id',
|
58
|
+
return_type: 'User',
|
59
|
+
result: user,
|
60
|
+
},
|
61
|
+
{
|
62
|
+
method: 'PUT',
|
63
|
+
path: "/um/users/#{subject_config[:user_id]}",
|
64
|
+
operation: :'UserManagementApi.um_users_put',
|
65
|
+
return_type: 'User',
|
66
|
+
body: {
|
67
|
+
properties: {
|
68
|
+
firstname: subject_config[:firstname],
|
69
|
+
lastname: subject_config[:lastname],
|
70
|
+
email: subject_config[:email],
|
71
|
+
administrator: subject_config[:administrator].to_s.downcase == 'true',
|
72
|
+
forceSecAuth: subject_config[:force_sec_auth].to_s.downcase == 'true',
|
73
|
+
secAuthActive: subject_config[:sec_auth_active].to_s.downcase == 'true',
|
74
|
+
active: subject_config[:active].to_s.downcase == 'true',
|
75
|
+
},
|
76
|
+
},
|
77
|
+
result: user,
|
78
|
+
},
|
79
|
+
{
|
80
|
+
method: 'GET',
|
81
|
+
path: "/um/users/#{subject_config[:user_id]}",
|
82
|
+
operation: :'UserManagementApi.um_users_find_by_id',
|
83
|
+
return_type: 'User',
|
84
|
+
result: user,
|
85
|
+
},
|
86
|
+
],
|
87
|
+
)
|
88
|
+
|
89
|
+
expect { subject.run }.not_to raise_error(Exception)
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'should not make any call if any required option is missing' do
|
93
|
+
required_options = subject.instance_variable_get(:@required_options)
|
94
|
+
|
95
|
+
arrays_without_one_element(required_options).each do |test_case|
|
96
|
+
|
97
|
+
test_case[:array].each { |value| subject.config[value] = 'test' }
|
98
|
+
|
99
|
+
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
100
|
+
expect(subject.api_client).not_to receive(:call_api)
|
101
|
+
|
102
|
+
expect { subject.run }.to raise_error(SystemExit) do |error|
|
103
|
+
expect(error.status).to eq(1)
|
104
|
+
end
|
105
|
+
|
106
|
+
required_options.each { |value| subject.config[value] = nil }
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
@@ -12,7 +12,7 @@ describe Chef::Knife::IonoscloudVolumeAttach do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
describe '#run' do
|
15
|
-
it 'should call
|
15
|
+
it 'should call ServersApi.datacenters_servers_volumes_post when the ID is valid' do
|
16
16
|
volume = volume_mock
|
17
17
|
subject_config = {
|
18
18
|
ionoscloud_username: 'email',
|
@@ -35,7 +35,7 @@ describe Chef::Knife::IonoscloudVolumeAttach do
|
|
35
35
|
{
|
36
36
|
method: 'POST',
|
37
37
|
path: "/datacenters/#{subject_config[:datacenter_id]}/servers/#{subject_config[:server_id]}/volumes",
|
38
|
-
operation: :'
|
38
|
+
operation: :'ServersApi.datacenters_servers_volumes_post',
|
39
39
|
body: { id: volume.id },
|
40
40
|
return_type: 'Volume',
|
41
41
|
result: volume,
|
@@ -46,7 +46,7 @@ describe Chef::Knife::IonoscloudVolumeAttach do
|
|
46
46
|
expect { subject.run }.not_to raise_error(Exception)
|
47
47
|
end
|
48
48
|
|
49
|
-
it 'should not call
|
49
|
+
it 'should not call ServersApi.datacenters_servers_volumes_post when the ID is not valid' do
|
50
50
|
volume_id = 'invalid_id'
|
51
51
|
subject_config = {
|
52
52
|
ionoscloud_username: 'email',
|
@@ -67,7 +67,7 @@ describe Chef::Knife::IonoscloudVolumeAttach do
|
|
67
67
|
{
|
68
68
|
method: 'POST',
|
69
69
|
path: "/datacenters/#{subject_config[:datacenter_id]}/servers/#{subject_config[:server_id]}/volumes",
|
70
|
-
operation: :'
|
70
|
+
operation: :'ServersApi.datacenters_servers_volumes_post',
|
71
71
|
body: { id: volume_id },
|
72
72
|
return_type: 'Volume',
|
73
73
|
exception: Ionoscloud::ApiError.new(code: 404),
|
@@ -12,7 +12,7 @@ describe Chef::Knife::IonoscloudVolumeCreate do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
describe '#run' do
|
15
|
-
it 'should call
|
15
|
+
it 'should call VolumesApi.datacenters_volumes_post with the expected arguments and output based on what it receives' do
|
16
16
|
volume = volume_mock
|
17
17
|
subject_config = {
|
18
18
|
ionoscloud_username: 'email',
|
@@ -23,27 +23,37 @@ describe Chef::Knife::IonoscloudVolumeCreate do
|
|
23
23
|
type: volume.properties.type,
|
24
24
|
bus: volume.properties.bus,
|
25
25
|
availability_zone: volume.properties.availability_zone,
|
26
|
-
image_alias: 'debian:latest',
|
27
26
|
image_password: 'K3tTj8G14a3EgKyNeeiY',
|
27
|
+
image: volume.properties.image,
|
28
|
+
backupunit_id: volume.properties.backupunit_id,
|
29
|
+
user_data: volume.properties.user_data,
|
28
30
|
}
|
29
31
|
|
30
32
|
subject_config.each { |key, value| subject.config[key] = value }
|
31
33
|
|
32
34
|
expected_body = volume.properties.to_hash
|
33
|
-
expected_body.delete(:image)
|
34
35
|
expected_body.delete(:licenceType)
|
35
36
|
|
36
|
-
expected_body[:imageAlias] = subject_config[:image_alias]
|
37
37
|
expected_body[:imagePassword] = subject_config[:image_password]
|
38
38
|
|
39
39
|
expect(subject).to receive(:puts).with("ID: #{volume.id}")
|
40
|
-
expect(subject).to receive(:puts).with("Name: #{
|
41
|
-
expect(subject).to receive(:puts).with("Size: #{
|
42
|
-
expect(subject).to receive(:puts).with("Bus: #{
|
40
|
+
expect(subject).to receive(:puts).with("Name: #{volume.properties.name}")
|
41
|
+
expect(subject).to receive(:puts).with("Size: #{volume.properties.size}")
|
42
|
+
expect(subject).to receive(:puts).with("Bus: #{volume.properties.bus}")
|
43
43
|
expect(subject).to receive(:puts).with("Image: #{volume.properties.image}")
|
44
|
-
expect(subject).to receive(:puts).with("Type: #{
|
44
|
+
expect(subject).to receive(:puts).with("Type: #{volume.properties.type}")
|
45
45
|
expect(subject).to receive(:puts).with("Licence Type: #{volume.properties.licence_type}")
|
46
|
-
expect(subject).to receive(:puts).with("
|
46
|
+
expect(subject).to receive(:puts).with("Backupunit ID: #{volume.properties.backupunit_id}")
|
47
|
+
expect(subject).to receive(:puts).with("User Data: #{volume.properties.user_data}")
|
48
|
+
expect(subject).to receive(:puts).with("Zone: #{volume.properties.availability_zone}")
|
49
|
+
expect(subject).to receive(:puts).with("CPU Hot Plug: #{volume.properties.cpu_hot_plug}")
|
50
|
+
expect(subject).to receive(:puts).with("RAM Hot Plug: #{volume.properties.ram_hot_plug}")
|
51
|
+
expect(subject).to receive(:puts).with("NIC Hot Plug: #{volume.properties.nic_hot_plug}")
|
52
|
+
expect(subject).to receive(:puts).with("NIC Hot Unplug: #{volume.properties.nic_hot_unplug}")
|
53
|
+
expect(subject).to receive(:puts).with("Disc Virtio Hot Plug: #{volume.properties.disc_virtio_hot_plug}")
|
54
|
+
expect(subject).to receive(:puts).with("Disc Virtio Hot Unplug: #{volume.properties.disc_virtio_hot_unplug}")
|
55
|
+
expect(subject).to receive(:puts).with("Device number: #{volume.properties.device_number}")
|
56
|
+
expect(subject).to receive(:puts).with("PCI Slot: #{volume.properties.pci_slot}")
|
47
57
|
|
48
58
|
mock_wait_for(subject)
|
49
59
|
mock_call_api(
|
@@ -52,7 +62,7 @@ describe Chef::Knife::IonoscloudVolumeCreate do
|
|
52
62
|
{
|
53
63
|
method: 'POST',
|
54
64
|
path: "/datacenters/#{subject_config[:datacenter_id]}/volumes",
|
55
|
-
operation: :'
|
65
|
+
operation: :'VolumesApi.datacenters_volumes_post',
|
56
66
|
return_type: 'Volume',
|
57
67
|
body: { properties: expected_body },
|
58
68
|
result: volume,
|
@@ -60,7 +70,7 @@ describe Chef::Knife::IonoscloudVolumeCreate do
|
|
60
70
|
{
|
61
71
|
method: 'GET',
|
62
72
|
path: "/datacenters/#{subject_config[:datacenter_id]}/volumes/#{volume.id}",
|
63
|
-
operation: :'
|
73
|
+
operation: :'VolumesApi.datacenters_volumes_find_by_id',
|
64
74
|
return_type: 'Volume',
|
65
75
|
result: volume,
|
66
76
|
},
|
@@ -12,7 +12,7 @@ describe Chef::Knife::IonoscloudVolumeDelete do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
describe '#run' do
|
15
|
-
it 'should call
|
15
|
+
it 'should call VolumesApi.datacenters_volumes_delete when the ID is valid' do
|
16
16
|
volume = volume_mock
|
17
17
|
subject_config = {
|
18
18
|
ionoscloud_username: 'email',
|
@@ -31,7 +31,17 @@ describe Chef::Knife::IonoscloudVolumeDelete do
|
|
31
31
|
expect(subject).to receive(:puts).with("Image: #{volume.properties.image}")
|
32
32
|
expect(subject).to receive(:puts).with("Type: #{volume.properties.type}")
|
33
33
|
expect(subject).to receive(:puts).with("Licence Type: #{volume.properties.licence_type}")
|
34
|
+
expect(subject).to receive(:puts).with("Backupunit ID: #{volume.properties.backupunit_id}")
|
35
|
+
expect(subject).to receive(:puts).with("User Data: #{volume.properties.user_data}")
|
34
36
|
expect(subject).to receive(:puts).with("Zone: #{volume.properties.availability_zone}")
|
37
|
+
expect(subject).to receive(:puts).with("CPU Hot Plug: #{volume.properties.cpu_hot_plug}")
|
38
|
+
expect(subject).to receive(:puts).with("RAM Hot Plug: #{volume.properties.ram_hot_plug}")
|
39
|
+
expect(subject).to receive(:puts).with("NIC Hot Plug: #{volume.properties.nic_hot_plug}")
|
40
|
+
expect(subject).to receive(:puts).with("NIC Hot Unplug: #{volume.properties.nic_hot_unplug}")
|
41
|
+
expect(subject).to receive(:puts).with("Disc Virtio Hot Plug: #{volume.properties.disc_virtio_hot_plug}")
|
42
|
+
expect(subject).to receive(:puts).with("Disc Virtio Hot Unplug: #{volume.properties.disc_virtio_hot_unplug}")
|
43
|
+
expect(subject).to receive(:puts).with("Device number: #{volume.properties.device_number}")
|
44
|
+
expect(subject).to receive(:puts).with("PCI Slot: #{volume.properties.pci_slot}")
|
35
45
|
expect(subject.ui).to receive(:warn).with("Deleted Volume #{volume.id}. Request ID: ")
|
36
46
|
|
37
47
|
expect(subject).not_to receive(:wait_for)
|
@@ -42,14 +52,14 @@ describe Chef::Knife::IonoscloudVolumeDelete do
|
|
42
52
|
{
|
43
53
|
method: 'GET',
|
44
54
|
path: "/datacenters/#{subject_config[:datacenter_id]}/volumes/#{volume.id}",
|
45
|
-
operation: :'
|
55
|
+
operation: :'VolumesApi.datacenters_volumes_find_by_id',
|
46
56
|
return_type: 'Volume',
|
47
57
|
result: volume,
|
48
58
|
},
|
49
59
|
{
|
50
60
|
method: 'DELETE',
|
51
61
|
path: "/datacenters/#{subject_config[:datacenter_id]}/volumes/#{volume.id}",
|
52
|
-
operation: :'
|
62
|
+
operation: :'VolumesApi.datacenters_volumes_delete',
|
53
63
|
},
|
54
64
|
],
|
55
65
|
)
|
@@ -57,7 +67,7 @@ describe Chef::Knife::IonoscloudVolumeDelete do
|
|
57
67
|
expect { subject.run }.not_to raise_error(Exception)
|
58
68
|
end
|
59
69
|
|
60
|
-
it 'should not call
|
70
|
+
it 'should not call VolumesApi.datacenters_volumes_delete when the ID is not valid' do
|
61
71
|
volume_id = 'invalid_id'
|
62
72
|
subject_config = {
|
63
73
|
ionoscloud_username: 'email',
|
@@ -77,7 +87,7 @@ describe Chef::Knife::IonoscloudVolumeDelete do
|
|
77
87
|
{
|
78
88
|
method: 'GET',
|
79
89
|
path: "/datacenters/#{subject_config[:datacenter_id]}/volumes/#{volume_id}",
|
80
|
-
operation: :'
|
90
|
+
operation: :'VolumesApi.datacenters_volumes_find_by_id',
|
81
91
|
return_type: 'Volume',
|
82
92
|
exception: Ionoscloud::ApiError.new(code: 404),
|
83
93
|
},
|