knife-ionoscloud 5.1.1 → 6.0.0.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/README.md +1 -1
- data/docs/subcommands/composite_server_create.md +9 -3
- data/docs/subcommands/cube_server_create.md +91 -0
- data/docs/subcommands/firewall_create.md +5 -2
- data/docs/subcommands/flowlog_create.md +63 -0
- data/docs/subcommands/flowlog_delete.md +51 -0
- data/docs/subcommands/flowlog_list.md +51 -0
- data/docs/subcommands/group_create.md +10 -1
- data/docs/subcommands/natgateway_create.md +41 -0
- data/docs/subcommands/natgateway_delete.md +35 -0
- data/docs/subcommands/natgateway_lan_add.md +46 -0
- data/docs/subcommands/natgateway_lan_remove.md +39 -0
- data/docs/subcommands/natgateway_list.md +35 -0
- data/docs/subcommands/natgateway_rule_add.md +66 -0
- data/docs/subcommands/natgateway_rule_list.md +38 -0
- data/docs/subcommands/natgateway_rule_remove.md +39 -0
- data/docs/subcommands/networkloadbalancer_create.md +54 -0
- data/docs/subcommands/networkloadbalancer_delete.md +35 -0
- data/docs/subcommands/networkloadbalancer_list.md +35 -0
- data/docs/subcommands/networkloadbalancer_rule_add.md +72 -0
- data/docs/subcommands/networkloadbalancer_rule_list.md +39 -0
- data/docs/subcommands/networkloadbalancer_rule_remove.md +39 -0
- data/docs/subcommands/networkloadbalancer_rule_target_add.md +64 -0
- data/docs/subcommands/networkloadbalancer_rule_target_list.md +43 -0
- data/docs/subcommands/networkloadbalancer_rule_target_remove.md +51 -0
- data/docs/subcommands/nic_create.md +3 -3
- data/docs/subcommands/nodepool_lan_add.md +49 -0
- data/docs/subcommands/nodepool_lan_remove.md +39 -0
- data/docs/subcommands/server_console.md +39 -0
- data/docs/subcommands/server_list.md +4 -1
- data/docs/subcommands/server_resume.md +35 -0
- data/docs/subcommands/server_suspend.md +35 -0
- data/docs/subcommands/server_token.md +39 -0
- data/docs/subcommands/server_upgrade.md +39 -0
- data/docs/subcommands/template_list.md +31 -0
- data/docs/subcommands/volume_create.md +2 -5
- data/docs/summary.md +29 -0
- data/knife-ionoscloud.gemspec +1 -1
- data/lib/chef/knife/ionoscloud_backupunit_create.rb +12 -16
- data/lib/chef/knife/ionoscloud_backupunit_delete.rb +2 -5
- data/lib/chef/knife/ionoscloud_backupunit_get.rb +33 -0
- data/lib/chef/knife/ionoscloud_backupunit_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_backupunit_ssourl.rb +1 -1
- data/lib/chef/knife/ionoscloud_backupunit_update.rb +62 -0
- data/lib/chef/knife/ionoscloud_base.rb +309 -1
- data/lib/chef/knife/ionoscloud_composite_server_create.rb +23 -5
- data/lib/chef/knife/ionoscloud_contract_list.rb +32 -23
- data/lib/chef/knife/ionoscloud_cube_server_create.rb +212 -0
- data/lib/chef/knife/ionoscloud_datacenter_create.rb +11 -14
- data/lib/chef/knife/ionoscloud_datacenter_delete.rb +2 -7
- data/lib/chef/knife/ionoscloud_datacenter_get.rb +33 -0
- data/lib/chef/knife/ionoscloud_datacenter_list.rb +4 -2
- data/lib/chef/knife/ionoscloud_datacenter_update.rb +67 -0
- data/lib/chef/knife/ionoscloud_firewall_create.rb +16 -21
- data/lib/chef/knife/ionoscloud_firewall_delete.rb +5 -13
- data/lib/chef/knife/ionoscloud_firewall_get.rb +52 -0
- data/lib/chef/knife/ionoscloud_firewall_list.rb +5 -3
- data/lib/chef/knife/ionoscloud_firewall_update.rb +133 -0
- data/lib/chef/knife/ionoscloud_flowlog_create.rb +116 -0
- data/lib/chef/knife/ionoscloud_flowlog_delete.rb +103 -0
- data/lib/chef/knife/ionoscloud_flowlog_get.rb +84 -0
- data/lib/chef/knife/ionoscloud_flowlog_list.rb +101 -0
- data/lib/chef/knife/ionoscloud_flowlog_update.rb +127 -0
- data/lib/chef/knife/ionoscloud_group_create.rb +33 -27
- data/lib/chef/knife/ionoscloud_group_delete.rb +1 -11
- data/lib/chef/knife/ionoscloud_group_get.rb +1 -13
- data/lib/chef/knife/ionoscloud_group_list.rb +19 -7
- data/lib/chef/knife/ionoscloud_group_update.rb +131 -0
- data/lib/chef/knife/ionoscloud_group_user_add.rb +1 -18
- data/lib/chef/knife/ionoscloud_group_user_remove.rb +1 -18
- data/lib/chef/knife/ionoscloud_image_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_ipblock_create.rb +10 -13
- data/lib/chef/knife/ionoscloud_ipblock_delete.rb +1 -4
- data/lib/chef/knife/ionoscloud_ipblock_get.rb +33 -0
- data/lib/chef/knife/ionoscloud_ipblock_update.rb +57 -0
- data/lib/chef/knife/ionoscloud_ipfailover_add.rb +1 -1
- data/lib/chef/knife/ionoscloud_ipfailover_remove.rb +1 -1
- data/lib/chef/knife/ionoscloud_k8s_create.rb +27 -35
- data/lib/chef/knife/ionoscloud_k8s_delete.rb +1 -9
- data/lib/chef/knife/ionoscloud_k8s_get.rb +33 -0
- data/lib/chef/knife/ionoscloud_k8s_update.rb +99 -0
- data/lib/chef/knife/ionoscloud_label_add.rb +1 -1
- data/lib/chef/knife/ionoscloud_label_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_label_remove.rb +1 -1
- data/lib/chef/knife/ionoscloud_lan_create.rb +6 -14
- data/lib/chef/knife/ionoscloud_lan_delete.rb +3 -4
- data/lib/chef/knife/ionoscloud_lan_get.rb +38 -0
- data/lib/chef/knife/ionoscloud_lan_list.rb +2 -1
- data/lib/chef/knife/ionoscloud_lan_update.rb +76 -0
- data/lib/chef/knife/ionoscloud_loadbalancer_create.rb +4 -14
- data/lib/chef/knife/ionoscloud_loadbalancer_delete.rb +2 -9
- data/lib/chef/knife/ionoscloud_loadbalancer_get.rb +3 -13
- data/lib/chef/knife/ionoscloud_loadbalancer_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_loadbalancer_nic_add.rb +3 -15
- data/lib/chef/knife/ionoscloud_loadbalancer_nic_remove.rb +3 -16
- data/lib/chef/knife/ionoscloud_loadbalancer_update.rb +73 -0
- data/lib/chef/knife/ionoscloud_location_list.rb +5 -3
- data/lib/chef/knife/ionoscloud_natgateway_create.rb +60 -0
- data/lib/chef/knife/ionoscloud_natgateway_delete.rb +54 -0
- data/lib/chef/knife/ionoscloud_natgateway_get.rb +42 -0
- data/lib/chef/knife/ionoscloud_natgateway_lan_add.rb +74 -0
- data/lib/chef/knife/ionoscloud_natgateway_lan_remove.rb +52 -0
- data/lib/chef/knife/ionoscloud_natgateway_list.rb +51 -0
- data/lib/chef/knife/ionoscloud_natgateway_rule_add.rb +107 -0
- data/lib/chef/knife/ionoscloud_natgateway_rule_list.rb +65 -0
- data/lib/chef/knife/ionoscloud_natgateway_rule_remove.rb +55 -0
- data/lib/chef/knife/ionoscloud_natgateway_rule_update.rb +116 -0
- data/lib/chef/knife/ionoscloud_natgateway_update.rb +84 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_create.rb +89 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_delete.rb +62 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_get.rb +42 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_list.rb +57 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_add.rb +141 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_list.rb +65 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_remove.rb +68 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_target_add.rb +124 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_target_list.rb +70 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_target_remove.rb +88 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_update.rb +148 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_update.rb +98 -0
- data/lib/chef/knife/ionoscloud_nic_create.rb +17 -22
- data/lib/chef/knife/ionoscloud_nic_delete.rb +3 -7
- data/lib/chef/knife/ionoscloud_nic_get.rb +49 -0
- data/lib/chef/knife/ionoscloud_nic_list.rb +9 -5
- data/lib/chef/knife/ionoscloud_nic_update.rb +96 -0
- data/lib/chef/knife/ionoscloud_node_get.rb +49 -0
- data/lib/chef/knife/ionoscloud_node_list.rb +0 -1
- data/lib/chef/knife/ionoscloud_nodepool_create.rb +35 -48
- data/lib/chef/knife/ionoscloud_nodepool_delete.rb +1 -7
- data/lib/chef/knife/ionoscloud_nodepool_get.rb +43 -0
- data/lib/chef/knife/ionoscloud_nodepool_lan_add.rb +104 -0
- data/lib/chef/knife/ionoscloud_nodepool_lan_remove.rb +72 -0
- data/lib/chef/knife/ionoscloud_nodepool_list.rb +3 -1
- data/lib/chef/knife/ionoscloud_nodepool_update.rb +124 -0
- data/lib/chef/knife/ionoscloud_pcc_create.rb +12 -18
- data/lib/chef/knife/ionoscloud_pcc_delete.rb +2 -10
- data/lib/chef/knife/ionoscloud_pcc_get.rb +33 -0
- data/lib/chef/knife/ionoscloud_pcc_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_pcc_update.rb +63 -0
- data/lib/chef/knife/ionoscloud_request_get.rb +40 -0
- data/lib/chef/knife/ionoscloud_request_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_request_status.rb +1 -1
- data/lib/chef/knife/ionoscloud_s3key_create.rb +3 -7
- data/lib/chef/knife/ionoscloud_s3key_delete.rb +4 -7
- data/lib/chef/knife/ionoscloud_s3key_get.rb +38 -0
- data/lib/chef/knife/ionoscloud_s3key_list.rb +2 -2
- data/lib/chef/knife/ionoscloud_server_console.rb +43 -0
- data/lib/chef/knife/ionoscloud_server_create.rb +14 -26
- data/lib/chef/knife/ionoscloud_server_delete.rb +3 -9
- data/lib/chef/knife/ionoscloud_server_get.rb +43 -0
- data/lib/chef/knife/ionoscloud_server_list.rb +16 -5
- data/lib/chef/knife/ionoscloud_server_reboot.rb +1 -1
- data/lib/chef/knife/ionoscloud_server_resume.rb +44 -0
- data/lib/chef/knife/ionoscloud_server_start.rb +1 -1
- data/lib/chef/knife/ionoscloud_server_stop.rb +1 -1
- data/lib/chef/knife/ionoscloud_server_suspend.rb +45 -0
- data/lib/chef/knife/ionoscloud_server_token.rb +43 -0
- data/lib/chef/knife/ionoscloud_server_update.rb +97 -0
- data/lib/chef/knife/ionoscloud_server_upgrade.rb +45 -0
- data/lib/chef/knife/ionoscloud_share_create.rb +7 -11
- data/lib/chef/knife/ionoscloud_share_delete.rb +2 -3
- data/lib/chef/knife/ionoscloud_share_get.rb +38 -0
- data/lib/chef/knife/ionoscloud_share_update.rb +70 -0
- data/lib/chef/knife/ionoscloud_snapshot_create.rb +2 -10
- data/lib/chef/knife/ionoscloud_snapshot_delete.rb +2 -7
- data/lib/chef/knife/ionoscloud_snapshot_get.rb +32 -0
- data/lib/chef/knife/ionoscloud_snapshot_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_snapshot_restore.rb +3 -14
- data/lib/chef/knife/ionoscloud_snapshot_update.rb +126 -0
- data/lib/chef/knife/ionoscloud_template_list.rb +47 -0
- data/lib/chef/knife/ionoscloud_user_create.rb +1 -8
- data/lib/chef/knife/ionoscloud_user_delete.rb +1 -6
- data/lib/chef/knife/ionoscloud_user_get.rb +32 -0
- data/lib/chef/knife/ionoscloud_user_ssourl.rb +1 -1
- data/lib/chef/knife/ionoscloud_user_update.rb +92 -0
- data/lib/chef/knife/ionoscloud_volume_attach.rb +1 -1
- data/lib/chef/knife/ionoscloud_volume_create.rb +18 -34
- data/lib/chef/knife/ionoscloud_volume_delete.rb +3 -9
- data/lib/chef/knife/ionoscloud_volume_detach.rb +1 -1
- data/lib/chef/knife/ionoscloud_volume_get.rb +36 -0
- data/lib/chef/knife/ionoscloud_volume_list.rb +2 -2
- data/lib/chef/knife/ionoscloud_volume_update.rb +106 -0
- data/lib/knife-ionoscloud/version.rb +1 -1
- data/spec/chef/knife/ionoscloud_backupunit_create_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_backupunit_delete_spec.rb +5 -5
- data/spec/chef/knife/ionoscloud_backupunit_get_spec.rb +65 -0
- data/spec/chef/knife/ionoscloud_backupunit_list_spec.rb +1 -1
- data/spec/chef/knife/ionoscloud_backupunit_ssourl_spec.rb +3 -3
- data/spec/chef/knife/ionoscloud_backupunit_update_spec.rb +78 -0
- data/spec/chef/knife/ionoscloud_base_spec.rb +4 -4
- data/spec/chef/knife/ionoscloud_composite_server_create_spec.rb +11 -8
- data/spec/chef/knife/ionoscloud_contract_list_spec.rb +32 -27
- data/spec/chef/knife/ionoscloud_cube_server_create_spec.rb +249 -0
- data/spec/chef/knife/ionoscloud_datacenter_create_spec.rb +6 -2
- data/spec/chef/knife/ionoscloud_datacenter_delete_spec.rb +8 -5
- data/spec/chef/knife/ionoscloud_datacenter_get_spec.rb +69 -0
- data/spec/chef/knife/ionoscloud_datacenter_list_spec.rb +5 -3
- data/spec/chef/knife/ionoscloud_datacenter_update_spec.rb +82 -0
- data/spec/chef/knife/ionoscloud_firewall_create_spec.rb +5 -3
- data/spec/chef/knife/ionoscloud_firewall_delete_spec.rb +6 -5
- data/spec/chef/knife/ionoscloud_firewall_get_spec.rb +77 -0
- data/spec/chef/knife/ionoscloud_firewall_list_spec.rb +5 -3
- data/spec/chef/knife/ionoscloud_firewall_update_spec.rb +117 -0
- data/spec/chef/knife/ionoscloud_flowlog_create_spec.rb +254 -0
- data/spec/chef/knife/ionoscloud_flowlog_delete_spec.rb +360 -0
- data/spec/chef/knife/ionoscloud_flowlog_get_spec.rb +171 -0
- data/spec/chef/knife/ionoscloud_flowlog_list_spec.rb +264 -0
- data/spec/chef/knife/ionoscloud_flowlog_update_spec.rb +244 -0
- data/spec/chef/knife/ionoscloud_group_create_spec.rb +9 -0
- data/spec/chef/knife/ionoscloud_group_delete_spec.rb +6 -0
- data/spec/chef/knife/ionoscloud_group_get_spec.rb +6 -0
- data/spec/chef/knife/ionoscloud_group_list_spec.rb +26 -8
- data/spec/chef/knife/ionoscloud_group_update_spec.rb +121 -0
- data/spec/chef/knife/ionoscloud_group_user_add_spec.rb +6 -0
- data/spec/chef/knife/ionoscloud_group_user_remove_spec.rb +6 -0
- data/spec/chef/knife/ionoscloud_image_list_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_ipblock_get_spec.rb +66 -0
- data/spec/chef/knife/ionoscloud_ipblock_update_spec.rb +79 -0
- data/spec/chef/knife/ionoscloud_ipfailover_add_spec.rb +4 -4
- data/spec/chef/knife/ionoscloud_ipfailover_remove_spec.rb +7 -7
- data/spec/chef/knife/ionoscloud_k8s_create_spec.rb +7 -0
- data/spec/chef/knife/ionoscloud_k8s_delete_spec.rb +16 -11
- data/spec/chef/knife/ionoscloud_k8s_get_spec.rb +72 -0
- data/spec/chef/knife/ionoscloud_k8s_update_spec.rb +114 -0
- data/spec/chef/knife/ionoscloud_kubeconfig_get_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_label_add_spec.rb +10 -10
- data/spec/chef/knife/ionoscloud_label_list_spec.rb +14 -14
- data/spec/chef/knife/ionoscloud_label_remove_spec.rb +20 -20
- data/spec/chef/knife/ionoscloud_lan_create_spec.rb +4 -3
- data/spec/chef/knife/ionoscloud_lan_delete_spec.rb +7 -5
- data/spec/chef/knife/ionoscloud_lan_get_spec.rb +68 -0
- data/spec/chef/knife/ionoscloud_lan_list_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_lan_update_spec.rb +87 -0
- data/spec/chef/knife/ionoscloud_loadbalancer_create_spec.rb +3 -3
- data/spec/chef/knife/ionoscloud_loadbalancer_delete_spec.rb +5 -5
- data/spec/chef/knife/ionoscloud_loadbalancer_get_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_loadbalancer_list_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_loadbalancer_nic_add_spec.rb +6 -6
- data/spec/chef/knife/ionoscloud_loadbalancer_nic_remove_spec.rb +6 -6
- data/spec/chef/knife/ionoscloud_loadbalancer_update_spec.rb +89 -0
- data/spec/chef/knife/ionoscloud_location_list_spec.rb +5 -3
- data/spec/chef/knife/ionoscloud_natgateway_create_spec.rb +92 -0
- data/spec/chef/knife/ionoscloud_natgateway_delete_spec.rb +118 -0
- data/spec/chef/knife/ionoscloud_natgateway_get_spec.rb +81 -0
- data/spec/chef/knife/ionoscloud_natgateway_lan_add_spec.rb +158 -0
- data/spec/chef/knife/ionoscloud_natgateway_lan_remove_spec.rb +209 -0
- data/spec/chef/knife/ionoscloud_natgateway_list_spec.rb +79 -0
- data/spec/chef/knife/ionoscloud_natgateway_rule_add_spec.rb +99 -0
- data/spec/chef/knife/ionoscloud_natgateway_rule_list_spec.rb +92 -0
- data/spec/chef/knife/ionoscloud_natgateway_rule_remove_spec.rb +78 -0
- data/spec/chef/knife/ionoscloud_natgateway_rule_update_spec.rb +121 -0
- data/spec/chef/knife/ionoscloud_natgateway_update_spec.rb +121 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_create_spec.rb +93 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_delete_spec.rb +120 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_get_spec.rb +82 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_list_spec.rb +88 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_add_spec.rb +105 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_list_spec.rb +89 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_remove_spec.rb +150 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_target_add_spec.rb +113 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_target_list_spec.rb +85 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_target_remove_spec.rb +281 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_update_spec.rb +163 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_update_spec.rb +107 -0
- data/spec/chef/knife/ionoscloud_nic_create_spec.rb +9 -5
- data/spec/chef/knife/ionoscloud_nic_delete_spec.rb +8 -6
- data/spec/chef/knife/ionoscloud_nic_get_spec.rb +72 -0
- data/spec/chef/knife/ionoscloud_nic_list_spec.rb +12 -6
- data/spec/chef/knife/ionoscloud_nic_update_spec.rb +97 -0
- data/spec/chef/knife/ionoscloud_node_get_spec.rb +70 -0
- data/spec/chef/knife/ionoscloud_nodepool_create_spec.rb +10 -5
- data/spec/chef/knife/ionoscloud_nodepool_delete_spec.rb +14 -0
- data/spec/chef/knife/ionoscloud_nodepool_get_spec.rb +83 -0
- data/spec/chef/knife/ionoscloud_nodepool_lan_add_spec.rb +222 -0
- data/spec/chef/knife/ionoscloud_nodepool_lan_remove.rb +196 -0
- data/spec/chef/knife/ionoscloud_nodepool_list_spec.rb +3 -1
- data/spec/chef/knife/ionoscloud_nodepool_update_spec.rb +134 -0
- data/spec/chef/knife/ionoscloud_pcc_create_spec.rb +11 -8
- data/spec/chef/knife/ionoscloud_pcc_delete_spec.rb +7 -7
- data/spec/chef/knife/ionoscloud_pcc_get_spec.rb +71 -0
- data/spec/chef/knife/ionoscloud_pcc_list_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_pcc_update_spec.rb +83 -0
- data/spec/chef/knife/ionoscloud_request_get_spec.rb +69 -0
- data/spec/chef/knife/ionoscloud_request_list_spec.rb +16 -16
- data/spec/chef/knife/ionoscloud_request_status_spec.rb +3 -3
- data/spec/chef/knife/ionoscloud_s3key_create_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_s3key_delete_spec.rb +5 -5
- data/spec/chef/knife/ionoscloud_s3key_get_spec.rb +66 -0
- data/spec/chef/knife/ionoscloud_s3key_list_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_server_console_spec.rb +97 -0
- data/spec/chef/knife/ionoscloud_server_create_spec.rb +6 -3
- data/spec/chef/knife/ionoscloud_server_delete_spec.rb +8 -5
- data/spec/chef/knife/ionoscloud_server_get_spec.rb +74 -0
- data/spec/chef/knife/ionoscloud_server_list_spec.rb +63 -5
- data/spec/chef/knife/ionoscloud_server_reboot_spec.rb +3 -5
- data/spec/chef/knife/ionoscloud_server_resume_spec.rb +93 -0
- data/spec/chef/knife/ionoscloud_server_start_spec.rb +3 -5
- data/spec/chef/knife/ionoscloud_server_stop_spec.rb +3 -5
- data/spec/chef/knife/ionoscloud_server_suspend_spec.rb +93 -0
- data/spec/chef/knife/ionoscloud_server_token_spec.rb +97 -0
- data/spec/chef/knife/ionoscloud_server_update_spec.rb +105 -0
- data/spec/chef/knife/ionoscloud_server_upgrade_spec.rb +96 -0
- data/spec/chef/knife/ionoscloud_share_get_spec.rb +66 -0
- data/spec/chef/knife/ionoscloud_share_update_spec.rb +91 -0
- data/spec/chef/knife/ionoscloud_snapshot_create_spec.rb +15 -3
- data/spec/chef/knife/ionoscloud_snapshot_delete_spec.rb +17 -5
- data/spec/chef/knife/ionoscloud_snapshot_get_spec.rb +79 -0
- data/spec/chef/knife/ionoscloud_snapshot_list_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_snapshot_restore_spec.rb +12 -3
- data/spec/chef/knife/ionoscloud_snapshot_update_spec.rb +113 -0
- data/spec/chef/knife/ionoscloud_template_list_spec.rb +78 -0
- data/spec/chef/knife/ionoscloud_user_create_spec.rb +3 -1
- data/spec/chef/knife/ionoscloud_user_delete_spec.rb +4 -2
- data/spec/chef/knife/ionoscloud_user_get_spec.rb +70 -0
- data/spec/chef/knife/ionoscloud_user_ssourl_spec.rb +3 -3
- data/spec/chef/knife/ionoscloud_user_update_spec.rb +110 -0
- data/spec/chef/knife/ionoscloud_volume_attach_spec.rb +4 -4
- data/spec/chef/knife/ionoscloud_volume_create_spec.rb +21 -11
- data/spec/chef/knife/ionoscloud_volume_delete_spec.rb +15 -5
- data/spec/chef/knife/ionoscloud_volume_detach_spec.rb +5 -5
- data/spec/chef/knife/ionoscloud_volume_get_spec.rb +81 -0
- data/spec/chef/knife/ionoscloud_volume_list_spec.rb +4 -4
- data/spec/chef/knife/ionoscloud_volume_update_spec.rb +116 -0
- data/spec/spec_helper.rb +251 -39
- metadata +245 -6
@@ -0,0 +1,45 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudServerSuspend < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud server suspend SERVER_ID [SERVER_ID] (options)'
|
9
|
+
|
10
|
+
option :datacenter_id,
|
11
|
+
short: '-D DATACENTER_ID',
|
12
|
+
long: '--datacenter-id DATACENTER_ID',
|
13
|
+
description: 'ID of the data center'
|
14
|
+
|
15
|
+
attr_reader :description, :required_options
|
16
|
+
|
17
|
+
def initialize(args = [])
|
18
|
+
super(args)
|
19
|
+
@description =
|
20
|
+
'This will suspend a server. The operation can only be applied to Cube servers. '\
|
21
|
+
'Note: The virtual machine will not be deleted, and the consumed resources will continue to be billed.'
|
22
|
+
@required_options = [:datacenter_id, :ionoscloud_username, :ionoscloud_password]
|
23
|
+
end
|
24
|
+
|
25
|
+
def run
|
26
|
+
$stdout.sync = true
|
27
|
+
handle_extra_config
|
28
|
+
validate_required_params(@required_options, config)
|
29
|
+
|
30
|
+
server_api = Ionoscloud::ServersApi.new(api_client)
|
31
|
+
|
32
|
+
@name_args.each do |server_id|
|
33
|
+
begin
|
34
|
+
_, _, headers = server_api.datacenters_servers_suspend_post_with_http_info(config[:datacenter_id], server_id)
|
35
|
+
rescue Ionoscloud::ApiError => err
|
36
|
+
raise err unless err.code == 404
|
37
|
+
ui.error("Server ID #{server_id} not found. Skipping.")
|
38
|
+
next
|
39
|
+
end
|
40
|
+
ui.warn("Server #{server_id} is being suspended. Request ID: #{get_request_id headers}")
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudServerToken < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud server token (options)'
|
9
|
+
|
10
|
+
option :datacenter_id,
|
11
|
+
short: '-D DATACENTER_ID',
|
12
|
+
long: '--datacenter-id DATACENTER_ID',
|
13
|
+
description: 'The ID of the Datacenter.'
|
14
|
+
|
15
|
+
option :server_id,
|
16
|
+
short: '-S SERVER_ID',
|
17
|
+
long: '--server-id SERVER_ID',
|
18
|
+
description: 'The ID of the Server.'
|
19
|
+
|
20
|
+
attr_reader :description, :required_options
|
21
|
+
|
22
|
+
def initialize(args = [])
|
23
|
+
super(args)
|
24
|
+
@description =
|
25
|
+
'Returns the server json web token to be used for login operations (ex: accessing the server console).'
|
26
|
+
@required_options = [:datacenter_id, :server_id, :ionoscloud_username, :ionoscloud_password]
|
27
|
+
end
|
28
|
+
|
29
|
+
def run
|
30
|
+
$stdout.sync = true
|
31
|
+
handle_extra_config
|
32
|
+
validate_required_params(@required_options, config)
|
33
|
+
|
34
|
+
begin
|
35
|
+
puts Ionoscloud::ServersApi.new(api_client).datacenters_servers_token_get(config[:datacenter_id], config[:server_id]).token
|
36
|
+
rescue Ionoscloud::ApiError => err
|
37
|
+
raise err unless err.code == 404
|
38
|
+
ui.error("Server ID #{config[:server_id]} not found.")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudServerUpdate < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud server update (options)'
|
9
|
+
|
10
|
+
option :datacenter_id,
|
11
|
+
short: '-D DATACENTER_ID',
|
12
|
+
long: '--datacenter-id DATACENTER_ID',
|
13
|
+
description: 'ID of the data center'
|
14
|
+
|
15
|
+
option :server_id,
|
16
|
+
short: '-S SERVER_ID',
|
17
|
+
long: '--server-id SERVER_ID',
|
18
|
+
description: 'The ID of the server to which the NIC is assigned'
|
19
|
+
|
20
|
+
option :name,
|
21
|
+
short: '-n NAME',
|
22
|
+
long: '--name NAME',
|
23
|
+
description: 'Name of the server'
|
24
|
+
|
25
|
+
option :cores,
|
26
|
+
short: '-C CORES',
|
27
|
+
long: '--cores CORES',
|
28
|
+
description: 'The number of processor cores'
|
29
|
+
|
30
|
+
option :cpu_family,
|
31
|
+
short: '-f CPU_FAMILY',
|
32
|
+
long: '--cpu-family CPU_FAMILY',
|
33
|
+
description: 'The family of the CPU (INTEL_XEON or AMD_OPTERON)'
|
34
|
+
|
35
|
+
option :ram,
|
36
|
+
short: '-r RAM',
|
37
|
+
long: '--ram RAM',
|
38
|
+
description: 'The amount of RAM in MB'
|
39
|
+
|
40
|
+
option :availability_zone,
|
41
|
+
short: '-a AVAILABILITY_ZONE',
|
42
|
+
long: '--availability-zone AVAILABILITY_ZONE',
|
43
|
+
description: 'The availability zone of the server'
|
44
|
+
|
45
|
+
option :boot_volume,
|
46
|
+
long: '--boot-volume VOLUME_ID',
|
47
|
+
description: 'Reference to a volume used for booting'
|
48
|
+
|
49
|
+
option :boot_cdrom,
|
50
|
+
long: '--boot-cdrom CDROM_ID',
|
51
|
+
description: 'Reference to a CD-ROM used for booting'
|
52
|
+
|
53
|
+
attr_reader :description, :required_options
|
54
|
+
|
55
|
+
def initialize(args = [])
|
56
|
+
super(args)
|
57
|
+
@description =
|
58
|
+
'Updates information about a Ionoscloud Server.'
|
59
|
+
@required_options = [:datacenter_id, :server_id, :ionoscloud_username, :ionoscloud_password]
|
60
|
+
@updatable_fields = [:name, :cores, :cpu_family, :ram, :availability_zone, :boot_volume, :boot_cdrom]
|
61
|
+
end
|
62
|
+
|
63
|
+
def run
|
64
|
+
$stdout.sync = true
|
65
|
+
handle_extra_config
|
66
|
+
validate_required_params(@required_options, config)
|
67
|
+
|
68
|
+
server_api = Ionoscloud::ServersApi.new(api_client)
|
69
|
+
|
70
|
+
if @updatable_fields.map { |el| config[el] }.any?
|
71
|
+
print "#{ui.color('Updating Server...', :magenta)}"
|
72
|
+
|
73
|
+
_, _, headers = server_api.datacenters_servers_patch_with_http_info(
|
74
|
+
config[:datacenter_id],
|
75
|
+
config[:server_id],
|
76
|
+
Ionoscloud::ServerProperties.new(
|
77
|
+
name: config[:name],
|
78
|
+
cores: config[:cores],
|
79
|
+
cpu_family: config[:cpu_family],
|
80
|
+
ram: config[:ram],
|
81
|
+
availability_zone: config[:availability_zone],
|
82
|
+
boot_cdrom: config.key?(:boot_cdrom) ? { id: config[:boot_cdrom] } : nil,
|
83
|
+
boot_volume: config.key?(:boot_volume) ? { id: config[:boot_volume] } : nil,
|
84
|
+
),
|
85
|
+
)
|
86
|
+
|
87
|
+
dot = ui.color('.', :magenta)
|
88
|
+
api_client.wait_for { print dot; is_done? get_request_id headers }
|
89
|
+
else
|
90
|
+
ui.warn("Nothing to update, please set one of the attributes #{@updatable_fields}.")
|
91
|
+
end
|
92
|
+
|
93
|
+
print_server(server_api.datacenters_servers_find_by_id(config[:datacenter_id], config[:server_id]))
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudServerUpgrade < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud server upgrade (options)'
|
9
|
+
|
10
|
+
option :datacenter_id,
|
11
|
+
short: '-D DATACENTER_ID',
|
12
|
+
long: '--datacenter-id DATACENTER_ID',
|
13
|
+
description: 'The ID of the Datacenter.'
|
14
|
+
|
15
|
+
option :server_id,
|
16
|
+
short: '-S SERVER_ID',
|
17
|
+
long: '--server-id SERVER_ID',
|
18
|
+
description: 'The ID of the Server.'
|
19
|
+
|
20
|
+
attr_reader :description, :required_options
|
21
|
+
|
22
|
+
def initialize(args = [])
|
23
|
+
super(args)
|
24
|
+
@description =
|
25
|
+
"This will upgrade the version of the server, if needed. To verify if there is an upgrade available for a server, "\
|
26
|
+
"call '/datacenters/{datacenterId}/servers?upgradeNeeded=true'."
|
27
|
+
@required_options = [:datacenter_id, :server_id, :ionoscloud_username, :ionoscloud_password]
|
28
|
+
end
|
29
|
+
|
30
|
+
def run
|
31
|
+
$stdout.sync = true
|
32
|
+
handle_extra_config
|
33
|
+
validate_required_params(@required_options, config)
|
34
|
+
|
35
|
+
begin
|
36
|
+
_, _, headers = Ionoscloud::ServersApi.new(api_client).datacenters_servers_upgrade_post(config[:datacenter_id], config[:server_id])
|
37
|
+
ui.info("Server #{config[:server_id]} is being upgraded. Request ID: #{get_request_id headers}")
|
38
|
+
rescue Ionoscloud::ApiError => err
|
39
|
+
raise err unless err.code == 404
|
40
|
+
ui.error("Server ID #{config[:server_id]} not found.")
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -50,22 +50,18 @@ class Chef
|
|
50
50
|
share, _, headers = user_management_api.um_groups_shares_post_with_http_info(
|
51
51
|
config[:group_id],
|
52
52
|
config[:resource_id],
|
53
|
-
|
54
|
-
properties:
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
53
|
+
Ionoscloud::GroupShare.new(
|
54
|
+
properties: Ionoscloud::GroupShareProperties.new(
|
55
|
+
edit_privilege: config[:edit_privilege],
|
56
|
+
share_privilege: config[:share_privilege],
|
57
|
+
),
|
58
|
+
),
|
59
59
|
)
|
60
60
|
|
61
61
|
dot = ui.color('.', :magenta)
|
62
62
|
api_client.wait_for { print dot; is_done? get_request_id headers }
|
63
63
|
|
64
|
-
|
65
|
-
puts "#{ui.color('ID', :cyan)}: #{share.id}"
|
66
|
-
puts "#{ui.color('Edit Privilege', :cyan)}: #{share.properties.edit_privilege.to_s}"
|
67
|
-
puts "#{ui.color('Share Privilege', :cyan)}: #{share.properties.share_privilege.to_s}"
|
68
|
-
puts 'done'
|
64
|
+
print_share(share)
|
69
65
|
end
|
70
66
|
end
|
71
67
|
end
|
@@ -37,9 +37,8 @@ class Chef
|
|
37
37
|
next
|
38
38
|
end
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
msg_pair('Share Privilege', share.properties.share_privilege.to_s)
|
40
|
+
print_share(share)
|
41
|
+
puts "\n"
|
43
42
|
|
44
43
|
begin
|
45
44
|
confirm('Do you really want to delete this Resource Share')
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudShareGet < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud share get (options)'
|
9
|
+
|
10
|
+
option :group_id,
|
11
|
+
short: '-G GROUP_ID',
|
12
|
+
long: '--group-id GROUP_ID',
|
13
|
+
description: 'ID of the group.'
|
14
|
+
|
15
|
+
option :resource_id,
|
16
|
+
short: '-R RESOURCE_ID',
|
17
|
+
long: '--resource-id RESOURCE_ID',
|
18
|
+
description: 'The ID of the resource.'
|
19
|
+
|
20
|
+
attr_reader :description, :required_options
|
21
|
+
|
22
|
+
def initialize(args = [])
|
23
|
+
super(args)
|
24
|
+
@description =
|
25
|
+
'Retrieves the attributes of a given Group Share.'
|
26
|
+
@required_options = [:group_id, :resource_id, :ionoscloud_username, :ionoscloud_password]
|
27
|
+
end
|
28
|
+
|
29
|
+
def run
|
30
|
+
$stdout.sync = true
|
31
|
+
handle_extra_config
|
32
|
+
validate_required_params(@required_options, config)
|
33
|
+
|
34
|
+
print_share(Ionoscloud::UserManagementApi.new(api_client).um_groups_shares_find_by_resource_id(config[:group_id], config[:resource_id]))
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudShareUpdate < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud share update (options)'
|
9
|
+
|
10
|
+
option :group_id,
|
11
|
+
short: '-G GROUP_ID',
|
12
|
+
long: '--group-id GROUP_ID',
|
13
|
+
description: 'ID of the group.'
|
14
|
+
|
15
|
+
option :resource_id,
|
16
|
+
short: '-R RESOURCE_ID',
|
17
|
+
long: '--resource-id RESOURCE_ID',
|
18
|
+
description: 'The ID of the resource.'
|
19
|
+
|
20
|
+
option :edit_privilege,
|
21
|
+
long: '--edit EDIT_PRIVILEGE',
|
22
|
+
description: 'The group has permission to edit privileges on this resource.'
|
23
|
+
|
24
|
+
option :share_privilege,
|
25
|
+
short: '-s SHARE_PRIVILEGE',
|
26
|
+
long: '--share SHARE_PRIVILEGE',
|
27
|
+
description: 'The group has permission to share this resource.'
|
28
|
+
|
29
|
+
attr_reader :description, :required_options
|
30
|
+
|
31
|
+
def initialize(args = [])
|
32
|
+
super(args)
|
33
|
+
@description =
|
34
|
+
'Updates information about a Ionoscloud Group Share.'
|
35
|
+
@required_options = [:group_id, :resource_id, :ionoscloud_username, :ionoscloud_password]
|
36
|
+
@updatable_fields = [:edit_privilege, :share_privilege]
|
37
|
+
end
|
38
|
+
|
39
|
+
def run
|
40
|
+
$stdout.sync = true
|
41
|
+
handle_extra_config
|
42
|
+
validate_required_params(@required_options, config)
|
43
|
+
|
44
|
+
user_management_api = Ionoscloud::UserManagementApi.new(api_client)
|
45
|
+
|
46
|
+
if @updatable_fields.map { |el| config[el] }.any?
|
47
|
+
print "#{ui.color('Updating Group Share...', :magenta)}"
|
48
|
+
|
49
|
+
share = user_management_api.um_groups_shares_find_by_resource_id(config[:group_id], config[:resource_id])
|
50
|
+
|
51
|
+
new_share = Ionoscloud::GroupShare.new(
|
52
|
+
properties: Ionoscloud::GroupShareProperties.new(
|
53
|
+
edit_privilege: (config.key?(:edit_privilege) ? config[:edit_privilege].to_s.downcase == 'true' : share.properties.edit_privilege),
|
54
|
+
share_privilege: (config.key?(:share_privilege) ? config[:share_privilege].to_s.downcase == 'true' : share.properties.share_privilege),
|
55
|
+
),
|
56
|
+
)
|
57
|
+
|
58
|
+
_, _, headers = user_management_api.um_groups_shares_put_with_http_info(config[:group_id], config[:resource_id], new_share)
|
59
|
+
|
60
|
+
dot = ui.color('.', :magenta)
|
61
|
+
api_client.wait_for { print dot; is_done? get_request_id headers }
|
62
|
+
else
|
63
|
+
ui.warn("Nothing to update, please set one of the attributes #{@updatable_fields}.")
|
64
|
+
end
|
65
|
+
|
66
|
+
print_share(user_management_api.um_groups_shares_find_by_resource_id(config[:group_id], config[:resource_id]))
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -52,7 +52,7 @@ class Chef
|
|
52
52
|
|
53
53
|
print "#{ui.color('Creating Snapshot...', :magenta)}"
|
54
54
|
|
55
|
-
volume_api = Ionoscloud::
|
55
|
+
volume_api = Ionoscloud::VolumesApi.new(api_client)
|
56
56
|
|
57
57
|
snapshot, _, headers = volume_api.datacenters_volumes_create_snapshot_post_with_http_info(
|
58
58
|
config[:datacenter_id],
|
@@ -68,15 +68,7 @@ class Chef
|
|
68
68
|
dot = ui.color('.', :magenta)
|
69
69
|
api_client.wait_for { print dot; is_done? get_request_id headers }
|
70
70
|
|
71
|
-
|
72
|
-
|
73
|
-
puts "\n"
|
74
|
-
puts "#{ui.color('ID', :cyan)}: #{snapshot.id}"
|
75
|
-
puts "#{ui.color('Name', :cyan)}: #{snapshot.properties.name}"
|
76
|
-
puts "#{ui.color('Description', :cyan)}: #{snapshot.properties.description}"
|
77
|
-
puts "#{ui.color('Location', :cyan)}: #{snapshot.properties.location}"
|
78
|
-
puts "#{ui.color('Size', :cyan)}: #{snapshot.properties.size.to_s}"
|
79
|
-
puts 'done'
|
71
|
+
print_snapshot(Ionoscloud::SnapshotsApi.new(api_client).snapshots_find_by_id(snapshot.id))
|
80
72
|
end
|
81
73
|
end
|
82
74
|
end
|
@@ -21,7 +21,7 @@ class Chef
|
|
21
21
|
handle_extra_config
|
22
22
|
validate_required_params(@required_options, config)
|
23
23
|
|
24
|
-
snapshot_api = Ionoscloud::
|
24
|
+
snapshot_api = Ionoscloud::SnapshotsApi.new(api_client)
|
25
25
|
|
26
26
|
@name_args.each do |snapshot_id|
|
27
27
|
begin
|
@@ -32,12 +32,7 @@ class Chef
|
|
32
32
|
next
|
33
33
|
end
|
34
34
|
|
35
|
-
|
36
|
-
msg_pair('Name', snapshot.properties.name)
|
37
|
-
msg_pair('Description', snapshot.properties.description)
|
38
|
-
msg_pair('Location', snapshot.properties.location)
|
39
|
-
msg_pair('Size', snapshot.properties.size.to_s)
|
40
|
-
|
35
|
+
print_snapshot(snapshot)
|
41
36
|
puts "\n"
|
42
37
|
|
43
38
|
begin
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudSnapshotGet < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud snapshot get (options)'
|
9
|
+
|
10
|
+
option :snapshot_id,
|
11
|
+
short: '-S SNAPSHOT_ID',
|
12
|
+
long: '--snapshot-id SNAPSHOT_ID',
|
13
|
+
description: 'ID of the group.'
|
14
|
+
|
15
|
+
attr_reader :description, :required_options
|
16
|
+
|
17
|
+
def initialize(args = [])
|
18
|
+
super(args)
|
19
|
+
@description =
|
20
|
+
'Retrieves the attributes of a given Snapshot.'
|
21
|
+
@required_options = [:snapshot_id, :ionoscloud_username, :ionoscloud_password]
|
22
|
+
end
|
23
|
+
|
24
|
+
def run
|
25
|
+
$stdout.sync = true
|
26
|
+
handle_extra_config
|
27
|
+
validate_required_params(@required_options, config)
|
28
|
+
print_snapshot(Ionoscloud::SnapshotsApi.new(api_client).snapshots_find_by_id(config[:snapshot_id]))
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -29,7 +29,7 @@ class Chef
|
|
29
29
|
ui.color('Size', :bold)
|
30
30
|
]
|
31
31
|
|
32
|
-
snapshot_api = Ionoscloud::
|
32
|
+
snapshot_api = Ionoscloud::SnapshotsApi.new(api_client)
|
33
33
|
|
34
34
|
snapshot_api.snapshots_get({ depth: 1 }).items.each do |snapshot|
|
35
35
|
snapshot_list << snapshot.id
|
@@ -39,7 +39,7 @@ class Chef
|
|
39
39
|
|
40
40
|
print "#{ui.color('Restoring Snapshot...', :magenta)}"
|
41
41
|
|
42
|
-
volume_api = Ionoscloud::
|
42
|
+
volume_api = Ionoscloud::VolumesApi.new(api_client)
|
43
43
|
|
44
44
|
_, _, headers = volume_api.datacenters_volumes_restore_snapshot_post_with_http_info(
|
45
45
|
config[:datacenter_id],
|
@@ -50,20 +50,9 @@ class Chef
|
|
50
50
|
dot = ui.color('.', :magenta)
|
51
51
|
api_client.wait_for { print dot; is_done? get_request_id headers }
|
52
52
|
|
53
|
-
volume_api = Ionoscloud::
|
53
|
+
volume_api = Ionoscloud::VolumesApi.new(api_client)
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
puts "\n"
|
58
|
-
puts "#{ui.color('ID', :cyan)}: #{volume.id}"
|
59
|
-
puts "#{ui.color('Name', :cyan)}: #{volume.properties.name}"
|
60
|
-
puts "#{ui.color('Size', :cyan)}: #{volume.properties.size}"
|
61
|
-
puts "#{ui.color('Bus', :cyan)}: #{volume.properties.bus}"
|
62
|
-
puts "#{ui.color('Image', :cyan)}: #{volume.properties.image}"
|
63
|
-
puts "#{ui.color('Type', :cyan)}: #{volume.properties.type}"
|
64
|
-
puts "#{ui.color('Licence Type', :cyan)}: #{volume.properties.licence_type}"
|
65
|
-
puts "#{ui.color('Zone', :cyan)}: #{volume.properties.availability_zone}"
|
66
|
-
puts 'done'
|
55
|
+
print_volume(volume_api.datacenters_volumes_find_by_id(config[:datacenter_id], config[:volume_id]))
|
67
56
|
end
|
68
57
|
end
|
69
58
|
end
|
@@ -0,0 +1,126 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudSnapshotUpdate < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud snapshot update (options)'
|
9
|
+
|
10
|
+
option :snapshot_id,
|
11
|
+
short: '-S SNAPSHOT_ID',
|
12
|
+
long: '--snapshot-id SNAPSHOT_ID',
|
13
|
+
description: 'ID of the Snapshot.'
|
14
|
+
|
15
|
+
option :name,
|
16
|
+
short: '-n NAME',
|
17
|
+
long: '--name NAME',
|
18
|
+
description: 'Name of the server'
|
19
|
+
|
20
|
+
option :description,
|
21
|
+
long: '--description DESCRIPTION',
|
22
|
+
description: 'The number of processor cores'
|
23
|
+
|
24
|
+
option :sec_auth_protection,
|
25
|
+
long: '--sec-auth-protection SEC_AUTH_PROTECTION',
|
26
|
+
description: 'Boolean value representing if the snapshot requires extra protection e.g. two factor protection'
|
27
|
+
|
28
|
+
option :licence_type,
|
29
|
+
short: '-l LICENCE',
|
30
|
+
long: '--licence-type LICENCE',
|
31
|
+
description: 'The licence type of the snapshot (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
32
|
+
|
33
|
+
option :cpu_hot_plug,
|
34
|
+
long: '--cpu-hot-plug CPU_HOT_PLUG',
|
35
|
+
description: 'The licence type of the snapshot (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
36
|
+
|
37
|
+
option :cpu_hot_unplug,
|
38
|
+
long: '--cpu-hot-unplug CPU_HOT_UNPLUG',
|
39
|
+
description: 'The licence type of the snapshot (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
40
|
+
|
41
|
+
option :ram_hot_plug,
|
42
|
+
long: '--ram-hot-plug RAM_HOT_PLUG',
|
43
|
+
description: 'The licence type of the snapshot (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
44
|
+
|
45
|
+
option :ram_hot_unplug,
|
46
|
+
long: '--ram-hot-unplug RAM_HOT_UNPLUG',
|
47
|
+
description: 'The licence type of the snapshot (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
48
|
+
|
49
|
+
option :nic_hot_plug,
|
50
|
+
long: '--nic-hot-plug NIC_HOT_PLUG',
|
51
|
+
description: 'The licence type of the snapshot (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
52
|
+
|
53
|
+
option :nic_hot_unplug,
|
54
|
+
long: '--nic-hot-unplug NIC_HOT_UNPLUG',
|
55
|
+
description: 'The licence type of the snapshot (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
56
|
+
|
57
|
+
option :disc_virtio_hot_plug,
|
58
|
+
long: '--disc-virtio-hot_plug DISC_VIRTIO_HOT_PLUG',
|
59
|
+
description: 'The licence type of the snapshot (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
60
|
+
|
61
|
+
option :disc_virtio_hot_unplug,
|
62
|
+
long: '--disc-virtio-hot_unplug DISC_VIRTIO_HOT_UNPLUG',
|
63
|
+
description: 'The licence type of the snapshot (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
64
|
+
|
65
|
+
option :disc_scsi_hot_plug,
|
66
|
+
long: '--disc-scsi-hot-plug DISC_SCSI_HOT_PLUG',
|
67
|
+
description: 'The licence type of the snapshot (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
68
|
+
|
69
|
+
option :disc_scsi_hot_unplug,
|
70
|
+
long: '--disc-scsi-hot-unplug DISC_SCSI_HOT_UNPLUG',
|
71
|
+
description: 'The licence type of the snapshot (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
72
|
+
|
73
|
+
attr_reader :description, :required_options
|
74
|
+
|
75
|
+
def initialize(args = [])
|
76
|
+
super(args)
|
77
|
+
@description =
|
78
|
+
'Updates information about a Ionoscloud Snapshot.'
|
79
|
+
@required_options = [:snapshot_id, :ionoscloud_username, :ionoscloud_password]
|
80
|
+
@updatable_fields = [
|
81
|
+
:name, :description, :sec_auth_protection, :licence_type, :cpu_hot_plug, :cpu_hot_unplug, :ram_hot_plug, :ram_hot_unplug,
|
82
|
+
:nic_hot_plug, :nic_hot_unplug, :disc_virtio_hot_plug, :disc_virtio_hot_unplug, :disc_scsi_hot_plug, :disc_scsi_hot_unplug,
|
83
|
+
]
|
84
|
+
end
|
85
|
+
|
86
|
+
def run
|
87
|
+
$stdout.sync = true
|
88
|
+
handle_extra_config
|
89
|
+
validate_required_params(@required_options, config)
|
90
|
+
|
91
|
+
server_api = Ionoscloud::SnapshotsApi.new(api_client)
|
92
|
+
|
93
|
+
if @updatable_fields.map { |el| config[el] }.any?
|
94
|
+
print "#{ui.color('Updating Snapshot...', :magenta)}"
|
95
|
+
|
96
|
+
_, _, headers = server_api.snapshots_patch_with_http_info(
|
97
|
+
config[:snapshot_id],
|
98
|
+
Ionoscloud::SnapshotProperties.new(
|
99
|
+
name: config[:name],
|
100
|
+
description: config[:description],
|
101
|
+
sec_auth_protection: (config.key?(:sec_auth_protection) ? config[:sec_auth_protection].to_s.downcase == 'true' : nil),
|
102
|
+
licence_type: config[:licence_type],
|
103
|
+
cpu_hot_plug: (config.key?(:cpu_hot_plug) ? config[:cpu_hot_plug].to_s.downcase == 'true' : nil),
|
104
|
+
cpu_hot_unplug: (config.key?(:cpu_hot_unplug) ? config[:cpu_hot_unplug].to_s.downcase == 'true' : nil),
|
105
|
+
ram_hot_plug: (config.key?(:ram_hot_plug) ? config[:ram_hot_plug].to_s.downcase == 'true' : nil),
|
106
|
+
ram_hot_unplug: (config.key?(:ram_hot_unplug) ? config[:ram_hot_unplug].to_s.downcase == 'true' : nil),
|
107
|
+
nic_hot_plug: (config.key?(:nic_hot_plug) ? config[:nic_hot_plug].to_s.downcase == 'true' : nil),
|
108
|
+
nic_hot_unplug: (config.key?(:nic_hot_unplug) ? config[:nic_hot_unplug].to_s.downcase == 'true' : nil),
|
109
|
+
disc_virtio_hot_plug: (config.key?(:disc_virtio_hot_plug) ? config[:disc_virtio_hot_plug].to_s.downcase == 'true' : nil),
|
110
|
+
disc_virtio_hot_unplug: (config.key?(:disc_virtio_hot_unplug) ? config[:disc_virtio_hot_unplug].to_s.downcase == 'true' : nil),
|
111
|
+
disc_scsi_hot_plug: (config.key?(:disc_scsi_hot_plug) ? config[:disc_scsi_hot_plug].to_s.downcase == 'true' : nil),
|
112
|
+
disc_scsi_hot_unplug: (config.key?(:disc_scsi_hot_unplug) ? config[:disc_scsi_hot_unplug].to_s.downcase == 'true' : nil),
|
113
|
+
),
|
114
|
+
)
|
115
|
+
|
116
|
+
dot = ui.color('.', :magenta)
|
117
|
+
api_client.wait_for { print dot; is_done? get_request_id headers }
|
118
|
+
else
|
119
|
+
ui.warn("Nothing to update, please set one of the attributes #{@updatable_fields}.")
|
120
|
+
end
|
121
|
+
|
122
|
+
print_snapshot(server_api.snapshots_find_by_id(config[:snapshot_id]))
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|