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,133 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudFirewallUpdate < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud firewall update (options)'
|
9
|
+
|
10
|
+
option :datacenter_id,
|
11
|
+
short: '-D DATACENTER_ID',
|
12
|
+
long: '--datacenter-id DATACENTER_ID',
|
13
|
+
description: 'The 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'
|
19
|
+
|
20
|
+
option :nic_id,
|
21
|
+
short: '-N NIC_ID',
|
22
|
+
long: '--nic-id NIC_ID',
|
23
|
+
description: 'ID of the NIC'
|
24
|
+
|
25
|
+
option :firewall_id,
|
26
|
+
short: '-F FIREWALL_ID',
|
27
|
+
long: '--firewall-id FIREWALL_ID',
|
28
|
+
description: 'ID of the Firewall Rule'
|
29
|
+
|
30
|
+
option :name,
|
31
|
+
short: '-n NAME',
|
32
|
+
long: '--name NAME',
|
33
|
+
description: 'Name of the Firewall Rule'
|
34
|
+
|
35
|
+
option :protocol,
|
36
|
+
short: '-P PROTOCOL',
|
37
|
+
long: '--protocol PROTOCOL',
|
38
|
+
default: 'TCP',
|
39
|
+
description: 'The protocol of the firewall rule (TCP, UDP, ICMP, ANY)'
|
40
|
+
|
41
|
+
option :source_mac,
|
42
|
+
short: '-m MAC',
|
43
|
+
long: '--source-mac MAC',
|
44
|
+
description: 'Only traffic originating from the respective MAC address is allowed'
|
45
|
+
|
46
|
+
option :source_ip,
|
47
|
+
short: '-I IP',
|
48
|
+
long: '--source-ip IP',
|
49
|
+
description: 'Only traffic originating from the respective IPv4' \
|
50
|
+
' address is allowed; null allows all source IPs'
|
51
|
+
|
52
|
+
option :target_ip,
|
53
|
+
long: '--target-ip IP',
|
54
|
+
description: 'In case the target NIC has multiple IP addresses,' \
|
55
|
+
' only traffic directed to the respective IP' \
|
56
|
+
' address of the NIC is allowed; null value allows' \
|
57
|
+
' all target IPs'
|
58
|
+
|
59
|
+
option :port_range_start,
|
60
|
+
short: '-p PORT',
|
61
|
+
long: '--port-range-start PORT',
|
62
|
+
description: 'Defines the start range of the allowed port(s)'
|
63
|
+
|
64
|
+
option :port_range_end,
|
65
|
+
short: '-t PORT',
|
66
|
+
long: '--port-range-end PORT',
|
67
|
+
description: 'Defines the end range of the allowed port(s)'
|
68
|
+
|
69
|
+
option :icmp_type,
|
70
|
+
long: '--icmp-type INT',
|
71
|
+
description: 'Defines the allowed type (from 0 to 254) if the' \
|
72
|
+
' protocol ICMP is chosen; null allows all types'
|
73
|
+
|
74
|
+
option :icmp_code,
|
75
|
+
long: '--icmp-code INT',
|
76
|
+
description: 'Defines the allowed code (from 0 to 254) if the' \
|
77
|
+
' protocol ICMP is chosen; null allows all codes'
|
78
|
+
|
79
|
+
attr_reader :description, :required_options
|
80
|
+
|
81
|
+
def initialize(args = [])
|
82
|
+
super(args)
|
83
|
+
@description =
|
84
|
+
'Updates information about a Ionoscloud Firewall Rule.'
|
85
|
+
@required_options = [:datacenter_id, :ionoscloud_username, :ionoscloud_password]
|
86
|
+
@updatable_fields = [
|
87
|
+
:name, :protocol, :source_mac, :source_ip, :target_ip,
|
88
|
+
:port_range_start, :port_range_end, :icmp_type, :icmp_code,
|
89
|
+
]
|
90
|
+
end
|
91
|
+
|
92
|
+
def run
|
93
|
+
$stdout.sync = true
|
94
|
+
handle_extra_config
|
95
|
+
validate_required_params(@required_options, config)
|
96
|
+
|
97
|
+
firewall_rules_api = Ionoscloud::FirewallRulesApi.new(api_client)
|
98
|
+
|
99
|
+
if @updatable_fields.map { |el| config[el] }.any?
|
100
|
+
print "#{ui.color('Updating Firewall Rule...', :magenta)}"
|
101
|
+
|
102
|
+
params = {
|
103
|
+
name: config[:name],
|
104
|
+
protocol: config[:protocol],
|
105
|
+
source_mac: config[:source_mac],
|
106
|
+
source_ip: config[:source_ip],
|
107
|
+
target_ip: config[:target_ip],
|
108
|
+
port_range_start: config[:port_range_start],
|
109
|
+
port_range_end: config[:port_range_end],
|
110
|
+
icmp_type: config[:icmp_type],
|
111
|
+
icmp_code: config[:icmp_code],
|
112
|
+
}
|
113
|
+
|
114
|
+
_, _, headers = firewall_rules_api.datacenters_servers_nics_firewallrules_patch_with_http_info(
|
115
|
+
config[:datacenter_id], config[:server_id], config[:nic_id], config[:firewall_id],
|
116
|
+
Ionoscloud::FirewallruleProperties.new(params.compact),
|
117
|
+
)
|
118
|
+
|
119
|
+
dot = ui.color('.', :magenta)
|
120
|
+
api_client.wait_for { print dot; is_done? get_request_id headers }
|
121
|
+
else
|
122
|
+
ui.warn("Nothing to update, please set one of the attributes #{@updatable_fields}.")
|
123
|
+
end
|
124
|
+
|
125
|
+
print_firewall_rule(
|
126
|
+
firewall_rules_api.datacenters_servers_nics_firewallrules_find_by_id(
|
127
|
+
config[:datacenter_id], config[:server_id], config[:nic_id], config[:firewall_id],
|
128
|
+
),
|
129
|
+
)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudFlowlogCreate < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud flowlog create (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 :type,
|
16
|
+
short: '-t FLOWLOG_TYPE',
|
17
|
+
long: '--type FLOWLOG_TYPE',
|
18
|
+
description: 'The object to which the flow log will be attached'
|
19
|
+
|
20
|
+
option :server_id,
|
21
|
+
short: '-S SERVER_ID',
|
22
|
+
long: '--server-id SERVER_ID',
|
23
|
+
description: 'ID of the server'
|
24
|
+
|
25
|
+
option :nic_id,
|
26
|
+
short: '-N NIC_ID',
|
27
|
+
long: '--nic-id NIC_ID',
|
28
|
+
description: 'ID of the NIC'
|
29
|
+
|
30
|
+
option :natgateway_id,
|
31
|
+
short: '-G NAT_GATEWAY_ID',
|
32
|
+
long: '--natgateway NAT_GATEWAY_ID',
|
33
|
+
description: 'ID of the NAT Gateway'
|
34
|
+
|
35
|
+
option :network_loadbalancer_id,
|
36
|
+
short: '-L NETWORK_LOADBALANCER',
|
37
|
+
long: '--network-loadbalancer NETWORK_LOADBALANCER',
|
38
|
+
description: 'ID of the Network Load Balancer'
|
39
|
+
|
40
|
+
option :name,
|
41
|
+
short: '-n NAME',
|
42
|
+
long: '--name NAME',
|
43
|
+
description: 'Name of the Flow Log'
|
44
|
+
|
45
|
+
option :action,
|
46
|
+
short: '-a ACTION',
|
47
|
+
long: '--action ACTION',
|
48
|
+
default: 'ALL',
|
49
|
+
description: 'Specifies the traffic action pattern. Must be one of ["ALL", "ACCEPTED", "REJECTED"].'
|
50
|
+
|
51
|
+
option :direction,
|
52
|
+
long: '--direction DIRECTION',
|
53
|
+
default: 'BIDIRECTIONAL',
|
54
|
+
description: 'Specifies the traffic direction pattern. Must be one of ["INGRESS", "EGRESS", "BIDIRECTIONAL"].'
|
55
|
+
|
56
|
+
option :bucket,
|
57
|
+
short: '-b BUCKET',
|
58
|
+
long: '--bucket BUCKET',
|
59
|
+
description: 'S3 bucket name of an existing IONOS Cloud S3 bucket. Ex. bucketName/key'
|
60
|
+
|
61
|
+
attr_reader :description, :required_options
|
62
|
+
|
63
|
+
def initialize(args = [])
|
64
|
+
super(args)
|
65
|
+
@description =
|
66
|
+
'This will add a Flow Log to the network interface, NAT Gateway or Network Load Balancer.'
|
67
|
+
@required_options = [:datacenter_id, :type, :ionoscloud_username, :ionoscloud_password]
|
68
|
+
end
|
69
|
+
|
70
|
+
def run
|
71
|
+
$stdout.sync = true
|
72
|
+
handle_extra_config
|
73
|
+
validate_required_params(@required_options, config)
|
74
|
+
|
75
|
+
print "#{ui.color('Creating Flow Log...', :magenta)}"
|
76
|
+
|
77
|
+
case config[:type]
|
78
|
+
when 'nic'
|
79
|
+
validate_required_params([:server_id, :nic_id], config)
|
80
|
+
flowlogs_api = Ionoscloud::FlowLogsApi.new(api_client)
|
81
|
+
method = flowlogs_api.method(:datacenters_servers_nics_flowlogs_post_with_http_info)
|
82
|
+
args = [config[:datacenter_id], config[:server_id], config[:nic_id]]
|
83
|
+
when 'natgateway'
|
84
|
+
validate_required_params([:natgateway_id], config)
|
85
|
+
flowlogs_api = Ionoscloud::NATGatewaysApi.new(api_client)
|
86
|
+
method = flowlogs_api.method(:datacenters_natgateways_flowlogs_post_with_http_info)
|
87
|
+
args = [config[:datacenter_id], config[:natgateway_id]]
|
88
|
+
when 'networkloadbalancer'
|
89
|
+
validate_required_params([:network_loadbalancer_id], config)
|
90
|
+
flowlogs_api = Ionoscloud::NetworkLoadBalancersApi.new(api_client)
|
91
|
+
method = flowlogs_api.method(:datacenters_networkloadbalancers_flowlogs_post_with_http_info)
|
92
|
+
args = [config[:datacenter_id], config[:network_loadbalancer_id]]
|
93
|
+
else
|
94
|
+
ui.error "Flow Log cannot belong to #{config[:type]}. Value must be one of ['nic', 'natgateway', 'networkloadbalancer']"
|
95
|
+
exit(1)
|
96
|
+
end
|
97
|
+
|
98
|
+
flowlog = Ionoscloud::FlowLog.new(
|
99
|
+
properties: Ionoscloud::FlowLogProperties.new({
|
100
|
+
name: config[:name],
|
101
|
+
action: config[:action],
|
102
|
+
direction: config[:direction],
|
103
|
+
bucket: config[:bucket],
|
104
|
+
}.compact),
|
105
|
+
)
|
106
|
+
|
107
|
+
flowlog, _, headers = method.call(*args, flowlog)
|
108
|
+
|
109
|
+
dot = ui.color('.', :magenta)
|
110
|
+
api_client.wait_for { print dot; is_done? get_request_id headers }
|
111
|
+
|
112
|
+
print_flowlog(flowlog)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudFlowlogDelete < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud flowlog delete FLOWLOG_ID [FLOWLOG_ID] (options)'
|
9
|
+
|
10
|
+
option :datacenter_id,
|
11
|
+
short: '-D DATACENTER_ID',
|
12
|
+
long: '--datacenter-id DATACENTER_ID',
|
13
|
+
description: 'The ID of the data center'
|
14
|
+
|
15
|
+
option :type,
|
16
|
+
short: '-t FLOWLOG_TYPE',
|
17
|
+
long: '--type FLOWLOG_TYPE',
|
18
|
+
description: 'The object to which the Flow Log will be attached'
|
19
|
+
|
20
|
+
option :server_id,
|
21
|
+
short: '-S SERVER_ID',
|
22
|
+
long: '--server-id SERVER_ID',
|
23
|
+
description: 'The ID of the server'
|
24
|
+
|
25
|
+
option :nic_id,
|
26
|
+
short: '-N NIC_ID',
|
27
|
+
long: '--nic-id NIC_ID',
|
28
|
+
description: 'ID of the NIC'
|
29
|
+
|
30
|
+
option :natgateway_id,
|
31
|
+
short: '-G NAT_GATEWAY_ID',
|
32
|
+
long: '--nat-gateway NAT_GATEWAY_ID',
|
33
|
+
description: 'ID of the NAT Gateway'
|
34
|
+
|
35
|
+
option :network_loadbalancer_id,
|
36
|
+
short: '-L NETWORK_LOADBALANCER',
|
37
|
+
long: '--network-loadbalancer NETWORK_LOADBALANCER',
|
38
|
+
description: 'ID of the Network Load Balancer'
|
39
|
+
|
40
|
+
attr_reader :description, :required_options
|
41
|
+
|
42
|
+
def initialize(args = [])
|
43
|
+
super(args)
|
44
|
+
@description =
|
45
|
+
'Removes the specified Flow Logs.'
|
46
|
+
@required_options = [:datacenter_id, :type, :ionoscloud_username, :ionoscloud_password]
|
47
|
+
end
|
48
|
+
|
49
|
+
def run
|
50
|
+
$stdout.sync = true
|
51
|
+
handle_extra_config
|
52
|
+
validate_required_params(@required_options, config)
|
53
|
+
|
54
|
+
flowlogs_api = Ionoscloud::FlowLogsApi.new(api_client)
|
55
|
+
|
56
|
+
case config[:type]
|
57
|
+
when 'nic'
|
58
|
+
validate_required_params([:server_id, :nic_id], config)
|
59
|
+
flowlogs_api = Ionoscloud::FlowLogsApi.new(api_client)
|
60
|
+
delete_method = flowlogs_api.method(:datacenters_servers_nics_flowlogs_delete_with_http_info)
|
61
|
+
get_method = flowlogs_api.method(:datacenters_servers_nics_flowlogs_find_by_id)
|
62
|
+
args = [config[:datacenter_id], config[:server_id], config[:nic_id]]
|
63
|
+
when 'natgateway'
|
64
|
+
validate_required_params([:natgateway_id], config)
|
65
|
+
flowlogs_api = Ionoscloud::NATGatewaysApi.new(api_client)
|
66
|
+
delete_method = flowlogs_api.method(:datacenters_natgateways_flowlogs_delete_with_http_info)
|
67
|
+
get_method = flowlogs_api.method(:datacenters_natgateways_flowlogs_find_by_flow_log_id)
|
68
|
+
args = [config[:datacenter_id], config[:natgateway_id]]
|
69
|
+
when 'networkloadbalancer'
|
70
|
+
validate_required_params([:network_loadbalancer_id], config)
|
71
|
+
flowlogs_api = Ionoscloud::NetworkLoadBalancersApi.new(api_client)
|
72
|
+
delete_method = flowlogs_api.method(:datacenters_networkloadbalancers_flowlogs_delete_with_http_info)
|
73
|
+
get_method = flowlogs_api.method(:datacenters_networkloadbalancers_flowlogs_find_by_flow_log_id)
|
74
|
+
args = [config[:datacenter_id], config[:network_loadbalancer_id]]
|
75
|
+
else
|
76
|
+
ui.error "Flow Log cannot belong to #{config[:type]}. Value must be one of ['nic', 'natgateway', 'networkloadbalancer']"
|
77
|
+
exit(1)
|
78
|
+
end
|
79
|
+
|
80
|
+
@name_args.each do |flowlog_id|
|
81
|
+
begin
|
82
|
+
flowlog = get_method.call(*args, flowlog_id)
|
83
|
+
rescue Ionoscloud::ApiError => err
|
84
|
+
raise err unless err.code == 404
|
85
|
+
ui.error("Flow Log ID #{flowlog_id} not found. Skipping.")
|
86
|
+
next
|
87
|
+
end
|
88
|
+
|
89
|
+
print_flowlog(flowlog)
|
90
|
+
|
91
|
+
begin
|
92
|
+
confirm('Do you really want to delete this Flow Log')
|
93
|
+
rescue SystemExit => exc
|
94
|
+
next
|
95
|
+
end
|
96
|
+
|
97
|
+
_, _, headers = delete_method.call(*args, flowlog_id)
|
98
|
+
ui.warn("Deleted Flow Log #{flowlog.id}. Request ID: #{get_request_id headers}")
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudFlowlogGet < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud flowlog get (options)'
|
9
|
+
|
10
|
+
option :datacenter_id,
|
11
|
+
short: '-D DATACENTER_ID',
|
12
|
+
long: '--datacenter-id DATACENTER_ID',
|
13
|
+
description: 'The ID of the data center'
|
14
|
+
|
15
|
+
option :type,
|
16
|
+
short: '-t FLOWLOG_TYPE',
|
17
|
+
long: '--type FLOWLOG_TYPE',
|
18
|
+
description: 'The object to which the Flow Log will be attached'
|
19
|
+
|
20
|
+
option :server_id,
|
21
|
+
short: '-S SERVER_ID',
|
22
|
+
long: '--server-id SERVER_ID',
|
23
|
+
description: 'The ID of the server'
|
24
|
+
|
25
|
+
option :nic_id,
|
26
|
+
short: '-N NIC_ID',
|
27
|
+
long: '--nic-id NIC_ID',
|
28
|
+
description: 'ID of the NIC'
|
29
|
+
|
30
|
+
option :natgateway_id,
|
31
|
+
short: '-G NAT_GATEWAY_ID',
|
32
|
+
long: '--nat-gateway NAT_GATEWAY_ID',
|
33
|
+
description: 'ID of the NAT Gateway'
|
34
|
+
|
35
|
+
option :network_loadbalancer_id,
|
36
|
+
short: '-L NETWORK_LOADBALANCER',
|
37
|
+
long: '--network-loadbalancer NETWORK_LOADBALANCER',
|
38
|
+
description: 'ID of the Network Load Balancer'
|
39
|
+
|
40
|
+
option :flowlog_id,
|
41
|
+
short: '-F FLOWLOG_ID',
|
42
|
+
long: '--flowlog-id FLOWLOG_ID',
|
43
|
+
description: 'The ID of the Flow Log'
|
44
|
+
|
45
|
+
attr_reader :description, :required_options
|
46
|
+
|
47
|
+
def initialize(args = [])
|
48
|
+
super(args)
|
49
|
+
@description =
|
50
|
+
'Retrieves information about a Ionoscloud Flow Log.'
|
51
|
+
@required_options = [:flowlog_id, :datacenter_id, :type, :ionoscloud_username, :ionoscloud_password]
|
52
|
+
end
|
53
|
+
|
54
|
+
def run
|
55
|
+
$stdout.sync = true
|
56
|
+
handle_extra_config
|
57
|
+
validate_required_params(@required_options, config)
|
58
|
+
|
59
|
+
case config[:type]
|
60
|
+
when 'nic'
|
61
|
+
validate_required_params([:server_id, :nic_id], config)
|
62
|
+
flowlog = Ionoscloud::FlowLogsApi.new(api_client).datacenters_servers_nics_flowlogs_find_by_id(
|
63
|
+
config[:datacenter_id], config[:server_id], config[:nic_id], config[:flowlog_id],
|
64
|
+
)
|
65
|
+
when 'natgateway'
|
66
|
+
validate_required_params([:natgateway_id], config)
|
67
|
+
flowlog = Ionoscloud::NATGatewaysApi.new(api_client).datacenters_natgateways_flowlogs_find_by_flow_log_id(
|
68
|
+
config[:datacenter_id], config[:natgateway_id], config[:flowlog_id],
|
69
|
+
)
|
70
|
+
when 'networkloadbalancer'
|
71
|
+
validate_required_params([:network_loadbalancer_id], config)
|
72
|
+
flowlog = Ionoscloud::NetworkLoadBalancersApi.new(api_client).datacenters_networkloadbalancers_flowlogs_find_by_flow_log_id(
|
73
|
+
config[:datacenter_id], config[:network_loadbalancer_id], config[:flowlog_id],
|
74
|
+
)
|
75
|
+
else
|
76
|
+
ui.error "Flow Log cannot belong to #{config[:type]}. Value must be one of ['nic', 'natgateway', 'networkloadbalancer']"
|
77
|
+
exit(1)
|
78
|
+
end
|
79
|
+
|
80
|
+
print_flowlog(flowlog)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,101 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudFlowlogList < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud flowlog list (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 :type,
|
16
|
+
short: '-t FLOWLOG_TYPE',
|
17
|
+
long: '--type FLOWLOG_TYPE',
|
18
|
+
description: 'The object to which the flow log will be attached'
|
19
|
+
|
20
|
+
option :server_id,
|
21
|
+
short: '-S SERVER_ID',
|
22
|
+
long: '--server-id SERVER_ID',
|
23
|
+
description: 'The ID of the server'
|
24
|
+
|
25
|
+
option :nic_id,
|
26
|
+
short: '-N NIC_ID',
|
27
|
+
long: '--nic-id NIC_ID',
|
28
|
+
description: 'ID of the NIC'
|
29
|
+
|
30
|
+
option :natgateway_id,
|
31
|
+
short: '-G NAT_GATEWAY_ID',
|
32
|
+
long: '--nat-gateway NAT_GATEWAY_ID',
|
33
|
+
description: 'ID of the NAT Gateway'
|
34
|
+
|
35
|
+
option :network_loadbalancer_id,
|
36
|
+
short: '-L NETWORK_LOADBALANCER',
|
37
|
+
long: '--network-loadbalancer NETWORK_LOADBALANCER',
|
38
|
+
description: 'ID of the Network Load Balancer'
|
39
|
+
|
40
|
+
attr_reader :description, :required_options
|
41
|
+
|
42
|
+
def initialize(args = [])
|
43
|
+
super(args)
|
44
|
+
@description =
|
45
|
+
'Lists all available flow logs assigned to a NIC, NAT Gateway or Network Load Balancer.'
|
46
|
+
@required_options = [:datacenter_id, :type, :ionoscloud_username, :ionoscloud_password]
|
47
|
+
end
|
48
|
+
|
49
|
+
def run
|
50
|
+
$stdout.sync = true
|
51
|
+
handle_extra_config
|
52
|
+
validate_required_params(@required_options, config)
|
53
|
+
|
54
|
+
flowlog_list = [
|
55
|
+
ui.color('ID', :bold),
|
56
|
+
ui.color('Name', :bold),
|
57
|
+
ui.color('Action', :bold),
|
58
|
+
ui.color('Direction', :bold),
|
59
|
+
ui.color('Bucket', :bold),
|
60
|
+
]
|
61
|
+
flowlogs = []
|
62
|
+
|
63
|
+
case config[:type]
|
64
|
+
when 'nic'
|
65
|
+
validate_required_params([:server_id, :nic_id], config)
|
66
|
+
flowlogs_api = Ionoscloud::FlowLogsApi.new(api_client)
|
67
|
+
flowlogs = flowlogs_api.datacenters_servers_nics_flowlogs_get(
|
68
|
+
config[:datacenter_id], config[:server_id], config[:nic_id], { depth: 1 }
|
69
|
+
)
|
70
|
+
when 'natgateway'
|
71
|
+
validate_required_params([:natgateway_id], config)
|
72
|
+
flowlogs_api = Ionoscloud::NATGatewaysApi.new(api_client)
|
73
|
+
flowlogs = flowlogs_api.datacenters_natgateways_flowlogs_get(
|
74
|
+
config[:datacenter_id], config[:natgateway_id], { depth: 1 }
|
75
|
+
)
|
76
|
+
when 'networkloadbalancer'
|
77
|
+
validate_required_params([:network_loadbalancer_id], config)
|
78
|
+
flowlogs_api = Ionoscloud::NetworkLoadBalancersApi.new(api_client)
|
79
|
+
flowlogs = flowlogs_api.datacenters_networkloadbalancers_flowlogs_get(
|
80
|
+
config[:datacenter_id], config[:network_loadbalancer_id], { depth: 1 }
|
81
|
+
)
|
82
|
+
else
|
83
|
+
ui.error "Flow log cannot belong to #{config[:type]}. Value must be one of ['nic', 'natgateway', 'networkloadbalancer']"
|
84
|
+
exit(1)
|
85
|
+
end
|
86
|
+
|
87
|
+
flowlogs_api = Ionoscloud::FlowLogsApi.new(api_client)
|
88
|
+
|
89
|
+
flowlogs.items.each do |flowlog|
|
90
|
+
flowlog_list << flowlog.id
|
91
|
+
flowlog_list << flowlog.properties.name
|
92
|
+
flowlog_list << flowlog.properties.action.to_s
|
93
|
+
flowlog_list << flowlog.properties.direction.to_s
|
94
|
+
flowlog_list << flowlog.properties.bucket.to_s
|
95
|
+
end
|
96
|
+
|
97
|
+
puts ui.list(flowlog_list, :uneven_columns_across, 5)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudFlowlogUpdate < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud flowlog update (options)'
|
9
|
+
|
10
|
+
option :datacenter_id,
|
11
|
+
short: '-D DATACENTER_ID',
|
12
|
+
long: '--datacenter-id DATACENTER_ID',
|
13
|
+
description: 'The ID of the data center'
|
14
|
+
|
15
|
+
option :type,
|
16
|
+
short: '-t FLOWLOG_TYPE',
|
17
|
+
long: '--type FLOWLOG_TYPE',
|
18
|
+
description: 'The object to which the Flow Log will be attached'
|
19
|
+
|
20
|
+
option :server_id,
|
21
|
+
short: '-S SERVER_ID',
|
22
|
+
long: '--server-id SERVER_ID',
|
23
|
+
description: 'The ID of the server'
|
24
|
+
|
25
|
+
option :nic_id,
|
26
|
+
short: '-N NIC_ID',
|
27
|
+
long: '--nic-id NIC_ID',
|
28
|
+
description: 'ID of the NIC'
|
29
|
+
|
30
|
+
option :natgateway_id,
|
31
|
+
short: '-G NAT_GATEWAY_ID',
|
32
|
+
long: '--nat-gateway NAT_GATEWAY_ID',
|
33
|
+
description: 'ID of the NAT Gateway'
|
34
|
+
|
35
|
+
option :network_loadbalancer_id,
|
36
|
+
short: '-L NETWORK_LOADBALANCER',
|
37
|
+
long: '--network-loadbalancer NETWORK_LOADBALANCER',
|
38
|
+
description: 'ID of the Network Load Balancer'
|
39
|
+
|
40
|
+
option :flowlog_id,
|
41
|
+
short: '-F FLOWLOG_ID',
|
42
|
+
long: '--flowlog-id FLOWLOG_ID',
|
43
|
+
description: 'The ID of the Flow Log'
|
44
|
+
|
45
|
+
option :name,
|
46
|
+
short: '-n NAME',
|
47
|
+
long: '--name NAME',
|
48
|
+
description: 'Name of the Flow Log'
|
49
|
+
|
50
|
+
option :action,
|
51
|
+
short: '-a ACTION',
|
52
|
+
long: '--action ACTION',
|
53
|
+
default: 'ALL',
|
54
|
+
description: 'Specifies the traffic action pattern. Must be one of ["ALL", "ACCEPTED", "REJECTED"].'
|
55
|
+
|
56
|
+
option :direction,
|
57
|
+
long: '--direction DIRECTION',
|
58
|
+
default: 'BIDIRECTIONAL',
|
59
|
+
description: 'Specifies the traffic direction pattern. Must be one of ["INGRESS", "EGRESS", "BIDIRECTIONAL"].'
|
60
|
+
|
61
|
+
option :bucket,
|
62
|
+
short: '-b BUCKET',
|
63
|
+
long: '--bucket BUCKET',
|
64
|
+
description: 'S3 bucket name of an existing IONOS Cloud S3 bucket. Ex. bucketName/key'
|
65
|
+
|
66
|
+
attr_reader :description, :required_options
|
67
|
+
|
68
|
+
def initialize(args = [])
|
69
|
+
super(args)
|
70
|
+
@description =
|
71
|
+
'Updates information about a Ionoscloud Flow Log.'
|
72
|
+
@required_options = [:flowlog_id, :datacenter_id, :type, :ionoscloud_username, :ionoscloud_password]
|
73
|
+
@updatable_fields = [:name, :action, :direction, :bucket]
|
74
|
+
end
|
75
|
+
|
76
|
+
def run
|
77
|
+
$stdout.sync = true
|
78
|
+
handle_extra_config
|
79
|
+
validate_required_params(@required_options, config)
|
80
|
+
|
81
|
+
case config[:type]
|
82
|
+
when 'nic'
|
83
|
+
validate_required_params([:server_id, :nic_id], config)
|
84
|
+
flowlogs_api = Ionoscloud::FlowLogsApi.new(api_client)
|
85
|
+
patch_method = flowlogs_api.method(:datacenters_servers_nics_flowlogs_patch_with_http_info)
|
86
|
+
get_method = flowlogs_api.method(:datacenters_servers_nics_flowlogs_find_by_id)
|
87
|
+
args = [config[:datacenter_id], config[:server_id], config[:nic_id], config[:flowlog_id]]
|
88
|
+
when 'natgateway'
|
89
|
+
validate_required_params([:natgateway_id], config)
|
90
|
+
flowlogs_api = Ionoscloud::NATGatewaysApi.new(api_client)
|
91
|
+
patch_method = flowlogs_api.method(:datacenters_natgateways_flowlogs_patch_with_http_info)
|
92
|
+
get_method = flowlogs_api.method(:datacenters_natgateways_flowlogs_find_by_flow_log_id)
|
93
|
+
args = [config[:datacenter_id], config[:natgateway_id], config[:flowlog_id]]
|
94
|
+
when 'networkloadbalancer'
|
95
|
+
validate_required_params([:network_loadbalancer_id], config)
|
96
|
+
flowlogs_api = Ionoscloud::NetworkLoadBalancersApi.new(api_client)
|
97
|
+
patch_method = flowlogs_api.method(:datacenters_networkloadbalancers_flowlogs_patch_with_http_info)
|
98
|
+
get_method = flowlogs_api.method(:datacenters_networkloadbalancers_flowlogs_find_by_flow_log_id)
|
99
|
+
args = [config[:datacenter_id], config[:network_loadbalancer_id], config[:flowlog_id]]
|
100
|
+
else
|
101
|
+
ui.error "Flow Log cannot belong to #{config[:type]}. Value must be one of ['nic', 'natgateway', 'networkloadbalancer']"
|
102
|
+
exit(1)
|
103
|
+
end
|
104
|
+
|
105
|
+
if @updatable_fields.map { |el| config[el] }.any?
|
106
|
+
print "#{ui.color('Updating Flow Log...', :magenta)}"
|
107
|
+
|
108
|
+
flowlog_properties = Ionoscloud::FlowLogProperties.new({
|
109
|
+
name: config[:name],
|
110
|
+
action: config[:action],
|
111
|
+
direction: config[:direction],
|
112
|
+
bucket: config[:bucket],
|
113
|
+
}.compact)
|
114
|
+
|
115
|
+
_, _, headers = patch_method.call(*args, flowlog_properties)
|
116
|
+
|
117
|
+
dot = ui.color('.', :magenta)
|
118
|
+
api_client.wait_for { print dot; is_done? get_request_id headers }
|
119
|
+
else
|
120
|
+
ui.warn("Nothing to update, please set one of the attributes #{@updatable_fields}.")
|
121
|
+
end
|
122
|
+
|
123
|
+
print_flowlog(get_method.call(*args))
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|