knife-ionoscloud 5.1.2 → 6.0.0
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 +16 -4
- data/docs/subcommands/backupunit_create.md +6 -3
- data/docs/subcommands/backupunit_delete.md +6 -3
- data/docs/subcommands/backupunit_get.md +6 -3
- data/docs/subcommands/backupunit_list.md +6 -3
- data/docs/subcommands/backupunit_ssourl.md +6 -3
- data/docs/subcommands/backupunit_update.md +6 -3
- data/docs/subcommands/composite_server_create.md +6 -3
- data/docs/subcommands/contract_list.md +6 -3
- data/docs/subcommands/cube_server_create.md +94 -0
- data/docs/subcommands/datacenter_create.md +6 -3
- data/docs/subcommands/datacenter_delete.md +6 -3
- data/docs/subcommands/datacenter_get.md +6 -3
- data/docs/subcommands/datacenter_list.md +6 -3
- data/docs/subcommands/datacenter_update.md +6 -3
- data/docs/subcommands/firewall_create.md +6 -3
- data/docs/subcommands/firewall_delete.md +5 -2
- data/docs/subcommands/firewall_get.md +6 -3
- data/docs/subcommands/firewall_list.md +6 -3
- data/docs/subcommands/firewall_update.md +6 -3
- data/docs/subcommands/flowlog_create.md +66 -0
- data/docs/subcommands/flowlog_delete.md +54 -0
- data/docs/subcommands/flowlog_get.md +58 -0
- data/docs/subcommands/flowlog_list.md +54 -0
- data/docs/subcommands/flowlog_update.md +70 -0
- data/docs/subcommands/group_create.md +6 -3
- data/docs/subcommands/group_delete.md +6 -3
- data/docs/subcommands/group_get.md +6 -3
- data/docs/subcommands/group_list.md +6 -3
- data/docs/subcommands/group_update.md +6 -3
- data/docs/subcommands/group_user_add.md +5 -2
- data/docs/subcommands/group_user_remove.md +5 -2
- data/docs/subcommands/image_list.md +6 -3
- data/docs/subcommands/ipblock_create.md +6 -3
- data/docs/subcommands/ipblock_delete.md +6 -3
- data/docs/subcommands/ipblock_get.md +6 -3
- data/docs/subcommands/ipblock_list.md +6 -3
- data/docs/subcommands/ipblock_update.md +6 -3
- data/docs/subcommands/ipfailover_add.md +6 -3
- data/docs/subcommands/ipfailover_remove.md +6 -3
- data/docs/subcommands/k8s_create.md +6 -6
- data/docs/subcommands/k8s_delete.md +6 -3
- data/docs/subcommands/k8s_get.md +6 -3
- data/docs/subcommands/k8s_list.md +6 -3
- data/docs/subcommands/k8s_update.md +6 -3
- data/docs/subcommands/kubeconfig_get.md +6 -3
- data/docs/subcommands/label_add.md +6 -3
- data/docs/subcommands/label_list.md +6 -3
- data/docs/subcommands/label_remove.md +5 -2
- data/docs/subcommands/lan_create.md +6 -3
- data/docs/subcommands/lan_delete.md +5 -2
- data/docs/subcommands/lan_get.md +6 -3
- data/docs/subcommands/lan_list.md +6 -3
- data/docs/subcommands/lan_update.md +6 -3
- data/docs/subcommands/loadbalancer_create.md +6 -3
- data/docs/subcommands/loadbalancer_delete.md +5 -2
- data/docs/subcommands/loadbalancer_get.md +6 -3
- data/docs/subcommands/loadbalancer_list.md +6 -3
- data/docs/subcommands/loadbalancer_nic_add.md +5 -2
- data/docs/subcommands/loadbalancer_nic_remove.md +5 -2
- data/docs/subcommands/loadbalancer_update.md +6 -3
- data/docs/subcommands/location_list.md +6 -3
- data/docs/subcommands/natgateway_create.md +44 -0
- data/docs/subcommands/natgateway_delete.md +38 -0
- data/docs/subcommands/natgateway_get.md +42 -0
- data/docs/subcommands/natgateway_lan_add.md +49 -0
- data/docs/subcommands/natgateway_lan_remove.md +42 -0
- data/docs/subcommands/natgateway_list.md +38 -0
- data/docs/subcommands/natgateway_rule_add.md +69 -0
- data/docs/subcommands/natgateway_rule_list.md +41 -0
- data/docs/subcommands/natgateway_rule_remove.md +42 -0
- data/docs/subcommands/natgateway_rule_update.md +69 -0
- data/docs/subcommands/natgateway_update.md +51 -0
- data/docs/subcommands/networkloadbalancer_create.md +57 -0
- data/docs/subcommands/networkloadbalancer_delete.md +38 -0
- data/docs/subcommands/networkloadbalancer_get.md +42 -0
- data/docs/subcommands/networkloadbalancer_list.md +38 -0
- data/docs/subcommands/networkloadbalancer_rule_add.md +75 -0
- data/docs/subcommands/networkloadbalancer_rule_list.md +42 -0
- data/docs/subcommands/networkloadbalancer_rule_remove.md +42 -0
- data/docs/subcommands/networkloadbalancer_rule_target_add.md +67 -0
- data/docs/subcommands/networkloadbalancer_rule_target_list.md +46 -0
- data/docs/subcommands/networkloadbalancer_rule_target_remove.md +54 -0
- data/docs/subcommands/networkloadbalancer_rule_update.md +75 -0
- data/docs/subcommands/networkloadbalancer_update.md +57 -0
- data/docs/subcommands/nic_create.md +6 -3
- data/docs/subcommands/nic_delete.md +5 -2
- data/docs/subcommands/nic_get.md +6 -3
- data/docs/subcommands/nic_list.md +6 -3
- data/docs/subcommands/nic_update.md +6 -3
- data/docs/subcommands/node_delete.md +5 -2
- data/docs/subcommands/node_get.md +6 -3
- data/docs/subcommands/node_list.md +6 -3
- data/docs/subcommands/node_replace.md +5 -2
- data/docs/subcommands/nodepool_create.md +6 -3
- data/docs/subcommands/nodepool_delete.md +5 -2
- data/docs/subcommands/nodepool_get.md +6 -3
- data/docs/subcommands/nodepool_lan_add.md +52 -0
- data/docs/subcommands/nodepool_lan_remove.md +42 -0
- data/docs/subcommands/nodepool_list.md +6 -3
- data/docs/subcommands/nodepool_update.md +6 -3
- data/docs/subcommands/pcc_create.md +6 -3
- data/docs/subcommands/pcc_delete.md +6 -3
- data/docs/subcommands/pcc_get.md +6 -3
- data/docs/subcommands/pcc_list.md +6 -3
- data/docs/subcommands/pcc_update.md +6 -3
- data/docs/subcommands/request_get.md +6 -3
- data/docs/subcommands/request_list.md +6 -3
- data/docs/subcommands/request_status.md +6 -3
- data/docs/subcommands/request_wait.md +6 -3
- data/docs/subcommands/resource_list.md +6 -3
- data/docs/subcommands/s3key_create.md +6 -3
- data/docs/subcommands/s3key_delete.md +5 -2
- data/docs/subcommands/s3key_get.md +6 -3
- data/docs/subcommands/s3key_list.md +6 -3
- data/docs/subcommands/server_console.md +42 -0
- data/docs/subcommands/server_create.md +6 -3
- data/docs/subcommands/server_delete.md +5 -2
- data/docs/subcommands/server_get.md +6 -3
- data/docs/subcommands/server_list.md +6 -3
- data/docs/subcommands/server_reboot.md +5 -2
- data/docs/subcommands/server_resume.md +38 -0
- data/docs/subcommands/server_start.md +5 -2
- data/docs/subcommands/server_stop.md +5 -2
- data/docs/subcommands/server_suspend.md +38 -0
- data/docs/subcommands/server_token.md +42 -0
- data/docs/subcommands/server_update.md +6 -3
- data/docs/subcommands/server_upgrade.md +42 -0
- data/docs/subcommands/share_create.md +6 -3
- data/docs/subcommands/share_delete.md +5 -2
- data/docs/subcommands/share_get.md +6 -3
- data/docs/subcommands/share_list.md +6 -3
- data/docs/subcommands/share_update.md +6 -3
- data/docs/subcommands/snapshot_create.md +6 -3
- data/docs/subcommands/snapshot_delete.md +6 -3
- data/docs/subcommands/snapshot_get.md +6 -3
- data/docs/subcommands/snapshot_list.md +6 -3
- data/docs/subcommands/snapshot_restore.md +6 -3
- data/docs/subcommands/snapshot_update.md +16 -13
- data/docs/subcommands/template_list.md +34 -0
- data/docs/subcommands/user_create.md +6 -3
- data/docs/subcommands/user_delete.md +6 -3
- data/docs/subcommands/user_get.md +6 -3
- data/docs/subcommands/user_list.md +6 -3
- data/docs/subcommands/user_ssourl.md +6 -3
- data/docs/subcommands/user_update.md +6 -3
- data/docs/subcommands/volume_attach.md +5 -2
- data/docs/subcommands/volume_create.md +6 -3
- data/docs/subcommands/volume_delete.md +5 -2
- data/docs/subcommands/volume_detach.md +5 -2
- data/docs/subcommands/volume_get.md +6 -3
- data/docs/subcommands/volume_list.md +6 -3
- data/docs/subcommands/volume_update.md +6 -3
- data/docs/summary.md +37 -0
- data/knife-ionoscloud.gemspec +1 -1
- data/lib/chef/knife/ionoscloud_backupunit_create.rb +2 -1
- data/lib/chef/knife/ionoscloud_backupunit_delete.rb +1 -1
- data/lib/chef/knife/ionoscloud_backupunit_get.rb +1 -1
- 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 +2 -2
- data/lib/chef/knife/ionoscloud_base.rb +111 -5
- data/lib/chef/knife/ionoscloud_composite_server_create.rb +37 -11
- 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 +2 -2
- data/lib/chef/knife/ionoscloud_datacenter_delete.rb +2 -1
- data/lib/chef/knife/ionoscloud_datacenter_get.rb +1 -1
- data/lib/chef/knife/ionoscloud_datacenter_list.rb +3 -3
- data/lib/chef/knife/ionoscloud_datacenter_update.rb +1 -1
- data/lib/chef/knife/ionoscloud_firewall_create.rb +16 -12
- data/lib/chef/knife/ionoscloud_firewall_delete.rb +3 -3
- data/lib/chef/knife/ionoscloud_firewall_get.rb +5 -3
- data/lib/chef/knife/ionoscloud_firewall_list.rb +5 -3
- data/lib/chef/knife/ionoscloud_firewall_update.rb +7 -6
- data/lib/chef/knife/ionoscloud_flowlog_create.rb +114 -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 +125 -0
- data/lib/chef/knife/ionoscloud_group_create.rb +31 -15
- data/lib/chef/knife/ionoscloud_group_get.rb +1 -3
- data/lib/chef/knife/ionoscloud_group_list.rb +7 -1
- data/lib/chef/knife/ionoscloud_group_update.rb +17 -0
- data/lib/chef/knife/ionoscloud_group_user_add.rb +1 -6
- data/lib/chef/knife/ionoscloud_group_user_remove.rb +1 -6
- data/lib/chef/knife/ionoscloud_image_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_ipblock_delete.rb +0 -1
- data/lib/chef/knife/ionoscloud_ipblock_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_ipfailover_add.rb +15 -8
- data/lib/chef/knife/ionoscloud_ipfailover_remove.rb +9 -2
- data/lib/chef/knife/ionoscloud_k8s_create.rb +13 -18
- 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 +1 -2
- data/lib/chef/knife/ionoscloud_lan_delete.rb +1 -1
- data/lib/chef/knife/ionoscloud_lan_get.rb +1 -1
- data/lib/chef/knife/ionoscloud_lan_list.rb +3 -4
- data/lib/chef/knife/ionoscloud_lan_update.rb +2 -13
- data/lib/chef/knife/ionoscloud_loadbalancer_create.rb +2 -1
- data/lib/chef/knife/ionoscloud_loadbalancer_delete.rb +2 -1
- data/lib/chef/knife/ionoscloud_loadbalancer_get.rb +5 -5
- data/lib/chef/knife/ionoscloud_loadbalancer_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_loadbalancer_nic_add.rb +4 -6
- data/lib/chef/knife/ionoscloud_loadbalancer_nic_remove.rb +4 -7
- data/lib/chef/knife/ionoscloud_loadbalancer_update.rb +1 -1
- 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 +105 -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 +135 -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 +123 -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 +25 -19
- data/lib/chef/knife/ionoscloud_nic_delete.rb +3 -2
- data/lib/chef/knife/ionoscloud_nic_get.rb +7 -5
- data/lib/chef/knife/ionoscloud_nic_list.rb +9 -5
- data/lib/chef/knife/ionoscloud_nic_update.rb +8 -5
- data/lib/chef/knife/ionoscloud_node_delete.rb +6 -1
- data/lib/chef/knife/ionoscloud_node_get.rb +7 -5
- data/lib/chef/knife/ionoscloud_node_list.rb +0 -1
- data/lib/chef/knife/ionoscloud_nodepool_create.rb +12 -21
- data/lib/chef/knife/ionoscloud_nodepool_get.rb +6 -4
- data/lib/chef/knife/ionoscloud_nodepool_lan_add.rb +103 -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_pcc_create.rb +4 -4
- data/lib/chef/knife/ionoscloud_pcc_delete.rb +1 -1
- data/lib/chef/knife/ionoscloud_pcc_get.rb +1 -1
- data/lib/chef/knife/ionoscloud_pcc_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_pcc_update.rb +1 -1
- data/lib/chef/knife/ionoscloud_request_get.rb +1 -1
- 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 +2 -2
- data/lib/chef/knife/ionoscloud_s3key_delete.rb +3 -3
- data/lib/chef/knife/ionoscloud_s3key_get.rb +1 -1
- 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 +5 -7
- data/lib/chef/knife/ionoscloud_server_delete.rb +3 -1
- data/lib/chef/knife/ionoscloud_server_get.rb +8 -6
- 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 +1 -1
- data/lib/chef/knife/ionoscloud_server_upgrade.rb +45 -0
- data/lib/chef/knife/ionoscloud_share_create.rb +1 -0
- data/lib/chef/knife/ionoscloud_share_delete.rb +2 -1
- data/lib/chef/knife/ionoscloud_snapshot_create.rb +2 -2
- data/lib/chef/knife/ionoscloud_snapshot_delete.rb +1 -1
- data/lib/chef/knife/ionoscloud_snapshot_get.rb +1 -1
- 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 +1 -1
- data/lib/chef/knife/ionoscloud_template_list.rb +47 -0
- data/lib/chef/knife/ionoscloud_user_create.rb +12 -23
- data/lib/chef/knife/ionoscloud_user_delete.rb +1 -0
- data/lib/chef/knife/ionoscloud_user_ssourl.rb +1 -1
- data/lib/chef/knife/ionoscloud_volume_attach.rb +1 -1
- data/lib/chef/knife/ionoscloud_volume_create.rb +18 -54
- data/lib/chef/knife/ionoscloud_volume_delete.rb +2 -1
- data/lib/chef/knife/ionoscloud_volume_detach.rb +9 -2
- data/lib/chef/knife/ionoscloud_volume_get.rb +1 -1
- data/lib/chef/knife/ionoscloud_volume_list.rb +2 -2
- data/lib/chef/knife/ionoscloud_volume_update.rb +3 -3
- 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 +2 -2
- 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 +3 -3
- 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 +3 -9
- data/spec/chef/knife/ionoscloud_datacenter_delete_spec.rb +5 -5
- data/spec/chef/knife/ionoscloud_datacenter_get_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_datacenter_list_spec.rb +4 -4
- data/spec/chef/knife/ionoscloud_datacenter_update_spec.rb +3 -3
- 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 +3 -2
- data/spec/chef/knife/ionoscloud_firewall_list_spec.rb +5 -3
- data/spec/chef/knife/ionoscloud_firewall_update_spec.rb +4 -3
- 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 -7
- data/spec/chef/knife/ionoscloud_group_delete_spec.rb +3 -0
- data/spec/chef/knife/ionoscloud_group_get_spec.rb +3 -0
- data/spec/chef/knife/ionoscloud_group_list_spec.rb +11 -2
- data/spec/chef/knife/ionoscloud_group_update_spec.rb +24 -12
- data/spec/chef/knife/ionoscloud_group_user_add_spec.rb +3 -0
- data/spec/chef/knife/ionoscloud_group_user_remove_spec.rb +3 -0
- data/spec/chef/knife/ionoscloud_image_list_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_ipblock_delete_spec.rb +0 -2
- data/spec/chef/knife/ionoscloud_ipblock_list_spec.rb +1 -1
- data/spec/chef/knife/ionoscloud_ipfailover_add_spec.rb +3 -4
- data/spec/chef/knife/ionoscloud_ipfailover_remove_spec.rb +4 -5
- data/spec/chef/knife/ionoscloud_k8s_create_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_k8s_delete_spec.rb +15 -16
- data/spec/chef/knife/ionoscloud_k8s_get_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_k8s_update_spec.rb +0 -1
- 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 +3 -3
- data/spec/chef/knife/ionoscloud_lan_delete_spec.rb +5 -5
- data/spec/chef/knife/ionoscloud_lan_get_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_lan_list_spec.rb +3 -5
- data/spec/chef/knife/ionoscloud_lan_update_spec.rb +4 -8
- 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 +3 -3
- 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 +5 -3
- data/spec/chef/knife/ionoscloud_nic_list_spec.rb +12 -6
- data/spec/chef/knife/ionoscloud_nic_update_spec.rb +10 -5
- data/spec/chef/knife/ionoscloud_nodepool_create_spec.rb +9 -11
- data/spec/chef/knife/ionoscloud_nodepool_delete_spec.rb +25 -25
- data/spec/chef/knife/ionoscloud_nodepool_get_spec.rb +1 -1
- 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 +5 -1
- data/spec/chef/knife/ionoscloud_pcc_create_spec.rb +7 -7
- data/spec/chef/knife/ionoscloud_pcc_delete_spec.rb +6 -6
- data/spec/chef/knife/ionoscloud_pcc_get_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_pcc_list_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_pcc_update_spec.rb +3 -3
- data/spec/chef/knife/ionoscloud_request_get_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_request_list_spec.rb +24 -25
- 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 +2 -2
- 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 +5 -2
- 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 +6 -3
- data/spec/chef/knife/ionoscloud_server_upgrade_spec.rb +96 -0
- data/spec/chef/knife/ionoscloud_snapshot_create_spec.rb +3 -4
- data/spec/chef/knife/ionoscloud_snapshot_delete_spec.rb +5 -5
- data/spec/chef/knife/ionoscloud_snapshot_get_spec.rb +2 -2
- 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 +3 -3
- data/spec/chef/knife/ionoscloud_template_list_spec.rb +78 -0
- data/spec/chef/knife/ionoscloud_user_ssourl_spec.rb +3 -3
- data/spec/chef/knife/ionoscloud_volume_attach_spec.rb +4 -4
- data/spec/chef/knife/ionoscloud_volume_create_spec.rb +12 -11
- data/spec/chef/knife/ionoscloud_volume_delete_spec.rb +6 -5
- data/spec/chef/knife/ionoscloud_volume_detach_spec.rb +5 -14
- data/spec/chef/knife/ionoscloud_volume_get_spec.rb +3 -2
- data/spec/chef/knife/ionoscloud_volume_list_spec.rb +4 -4
- data/spec/chef/knife/ionoscloud_volume_update_spec.rb +4 -3
- data/spec/spec_helper.rb +268 -96
- metadata +152 -4
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ionoscloud_natgateway_create'
|
3
|
+
|
4
|
+
Chef::Knife::IonoscloudNatgatewayCreate.load_deps
|
5
|
+
|
6
|
+
describe Chef::Knife::IonoscloudNatgatewayCreate do
|
7
|
+
before :each do
|
8
|
+
subject { Chef::Knife::IonoscloudNatgatewayCreate.new }
|
9
|
+
|
10
|
+
allow(subject).to receive(:puts)
|
11
|
+
allow(subject).to receive(:print)
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#run' do
|
15
|
+
it 'should call NATGatewaysApi.datacenters_natgateways_post with the expected arguments and output based on what it receives' do
|
16
|
+
natgateway = natgateway_mock
|
17
|
+
subject_config = {
|
18
|
+
ionoscloud_username: 'email',
|
19
|
+
ionoscloud_password: 'password',
|
20
|
+
datacenter_id: 'datacenter_id',
|
21
|
+
name: natgateway.properties.name,
|
22
|
+
ips: natgateway.properties.public_ips.join(','),
|
23
|
+
}.each do |key, value|
|
24
|
+
subject.config[key] = value
|
25
|
+
end
|
26
|
+
|
27
|
+
expect(subject).to receive(:puts).with("ID: #{natgateway.id}")
|
28
|
+
expect(subject).to receive(:puts).with("Name: #{natgateway.properties.name}")
|
29
|
+
expect(subject).to receive(:puts).with("IPS: #{natgateway.properties.public_ips}")
|
30
|
+
expect(subject).to receive(:puts).with("LANS: #{natgateway.properties.lans.map { |el| { id: el.id, gateway_ips: el.gateway_ips } }}")
|
31
|
+
expect(subject).to receive(:puts).with("Rules: #{natgateway.entities.rules.items.map do |el|
|
32
|
+
{
|
33
|
+
id: el.id,
|
34
|
+
name: el.properties.name,
|
35
|
+
type: el.properties.type,
|
36
|
+
protocol: el.properties.protocol,
|
37
|
+
public_ip: el.properties.public_ip,
|
38
|
+
source_subnet: el.properties.source_subnet,
|
39
|
+
target_subnet: el.properties.target_subnet,
|
40
|
+
target_port_range_start: el.properties.target_port_range ? el.properties.target_port_range.start : '',
|
41
|
+
target_port_range_end: el.properties.target_port_range ? el.properties.target_port_range._end : '',
|
42
|
+
}
|
43
|
+
end}")
|
44
|
+
expect(subject).to receive(:puts).with("Flowlogs: #{natgateway.entities.flowlogs.items.map { |flowlog| flowlog.id }}")
|
45
|
+
|
46
|
+
expected_properties = natgateway.properties.to_hash
|
47
|
+
expected_properties.delete(:lans)
|
48
|
+
|
49
|
+
mock_wait_for(subject)
|
50
|
+
mock_call_api(
|
51
|
+
subject,
|
52
|
+
[
|
53
|
+
{
|
54
|
+
method: 'POST',
|
55
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways",
|
56
|
+
operation: :'NATGatewaysApi.datacenters_natgateways_post',
|
57
|
+
return_type: 'NatGateway',
|
58
|
+
body: { properties: expected_properties },
|
59
|
+
result: natgateway,
|
60
|
+
},
|
61
|
+
{
|
62
|
+
method: 'GET',
|
63
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{natgateway.id}",
|
64
|
+
operation: :'NATGatewaysApi.datacenters_natgateways_find_by_nat_gateway_id',
|
65
|
+
return_type: 'NatGateway',
|
66
|
+
result: natgateway,
|
67
|
+
},
|
68
|
+
],
|
69
|
+
)
|
70
|
+
|
71
|
+
expect { subject.run }.not_to raise_error(Exception)
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'should not make any call if any required option is missing' do
|
75
|
+
required_options = subject.instance_variable_get(:@required_options)
|
76
|
+
|
77
|
+
arrays_without_one_element(required_options).each do |test_case|
|
78
|
+
|
79
|
+
test_case[:array].each { |value| subject.config[value] = 'test' }
|
80
|
+
|
81
|
+
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
82
|
+
expect(subject.api_client).not_to receive(:call_api)
|
83
|
+
|
84
|
+
expect { subject.run }.to raise_error(SystemExit) do |error|
|
85
|
+
expect(error.status).to eq(1)
|
86
|
+
end
|
87
|
+
|
88
|
+
required_options.each { |value| subject.config[value] = nil }
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ionoscloud_natgateway_delete'
|
3
|
+
|
4
|
+
Chef::Knife::IonoscloudNatgatewayDelete.load_deps
|
5
|
+
|
6
|
+
describe Chef::Knife::IonoscloudNatgatewayDelete do
|
7
|
+
before :each do
|
8
|
+
subject { Chef::Knife::IonoscloudNatgatewayDelete.new }
|
9
|
+
|
10
|
+
allow(subject).to receive(:puts)
|
11
|
+
allow(subject).to receive(:print)
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#run' do
|
15
|
+
it 'should call NATGatewaysApi.datacenters_natgateway_delete when the ID is valid' do
|
16
|
+
natgateway = natgateway_mock
|
17
|
+
subject_config = {
|
18
|
+
ionoscloud_username: 'email',
|
19
|
+
ionoscloud_password: 'password',
|
20
|
+
datacenter_id: 'datacenter_id',
|
21
|
+
yes: true,
|
22
|
+
}
|
23
|
+
|
24
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
25
|
+
subject.name_args = [natgateway.id]
|
26
|
+
|
27
|
+
expect(subject).to receive(:puts).with("ID: #{natgateway.id}")
|
28
|
+
expect(subject).to receive(:puts).with("Name: #{natgateway.properties.name}")
|
29
|
+
expect(subject).to receive(:puts).with("IPS: #{natgateway.properties.public_ips}")
|
30
|
+
expect(subject).to receive(:puts).with("LANS: #{natgateway.properties.lans.map { |el| { id: el.id, gateway_ips: el.gateway_ips } }}")
|
31
|
+
expect(subject).to receive(:puts).with("Rules: #{natgateway.entities.rules.items.map do |el|
|
32
|
+
{
|
33
|
+
id: el.id,
|
34
|
+
name: el.properties.name,
|
35
|
+
type: el.properties.type,
|
36
|
+
protocol: el.properties.protocol,
|
37
|
+
public_ip: el.properties.public_ip,
|
38
|
+
source_subnet: el.properties.source_subnet,
|
39
|
+
target_subnet: el.properties.target_subnet,
|
40
|
+
target_port_range_start: el.properties.target_port_range ? el.properties.target_port_range.start : '',
|
41
|
+
target_port_range_end: el.properties.target_port_range ? el.properties.target_port_range._end : '',
|
42
|
+
}
|
43
|
+
end}")
|
44
|
+
|
45
|
+
expect(subject.ui).to receive(:warn).with("Deleted NAT Gateway #{natgateway.id}. Request ID: ")
|
46
|
+
|
47
|
+
expect(subject.api_client).not_to receive(:wait_for)
|
48
|
+
expect(subject).to receive(:get_request_id).once
|
49
|
+
mock_call_api(
|
50
|
+
subject,
|
51
|
+
[
|
52
|
+
{
|
53
|
+
method: 'GET',
|
54
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{natgateway.id}",
|
55
|
+
operation: :'NATGatewaysApi.datacenters_natgateways_find_by_nat_gateway_id',
|
56
|
+
return_type: 'NatGateway',
|
57
|
+
result: natgateway,
|
58
|
+
},
|
59
|
+
{
|
60
|
+
method: 'DELETE',
|
61
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{natgateway.id}",
|
62
|
+
operation: :'NATGatewaysApi.datacenters_natgateways_delete',
|
63
|
+
},
|
64
|
+
],
|
65
|
+
)
|
66
|
+
|
67
|
+
expect { subject.run }.not_to raise_error(Exception)
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'should not call NATGatewaysApi.datacenters_natgateway_delete when the ID is not valid' do
|
71
|
+
natgateway_id = 'invalid_id'
|
72
|
+
subject_config = {
|
73
|
+
ionoscloud_username: 'email',
|
74
|
+
ionoscloud_password: 'password',
|
75
|
+
datacenter_id: 'datacenter_id',
|
76
|
+
}
|
77
|
+
|
78
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
79
|
+
subject.name_args = [natgateway_id]
|
80
|
+
|
81
|
+
expect(subject.ui).to receive(:error).with("NAT Gateway ID #{natgateway_id} not found. Skipping.")
|
82
|
+
|
83
|
+
expect(subject.api_client).not_to receive(:wait_for)
|
84
|
+
mock_call_api(
|
85
|
+
subject,
|
86
|
+
[
|
87
|
+
{
|
88
|
+
method: 'GET',
|
89
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{natgateway_id}",
|
90
|
+
operation: :'NATGatewaysApi.datacenters_natgateways_find_by_nat_gateway_id',
|
91
|
+
return_type: 'NatGateway',
|
92
|
+
exception: Ionoscloud::ApiError.new(code: 404),
|
93
|
+
},
|
94
|
+
],
|
95
|
+
)
|
96
|
+
|
97
|
+
expect { subject.run }.not_to raise_error(Exception)
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'should not make any call if any required option is missing' do
|
101
|
+
required_options = subject.instance_variable_get(:@required_options)
|
102
|
+
|
103
|
+
arrays_without_one_element(required_options).each do |test_case|
|
104
|
+
|
105
|
+
test_case[:array].each { |value| subject.config[value] = 'test' }
|
106
|
+
|
107
|
+
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
108
|
+
expect(subject.api_client).not_to receive(:call_api)
|
109
|
+
|
110
|
+
expect { subject.run }.to raise_error(SystemExit) do |error|
|
111
|
+
expect(error.status).to eq(1)
|
112
|
+
end
|
113
|
+
|
114
|
+
required_options.each { |value| subject.config[value] = nil }
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ionoscloud_natgateway_get'
|
3
|
+
|
4
|
+
Chef::Knife::IonoscloudNatgatewayGet.load_deps
|
5
|
+
|
6
|
+
describe Chef::Knife::IonoscloudNatgatewayGet do
|
7
|
+
before :each do
|
8
|
+
subject { Chef::Knife::IonoscloudNatgatewayGet.new }
|
9
|
+
|
10
|
+
allow(subject).to receive(:puts)
|
11
|
+
allow(subject).to receive(:print)
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#run' do
|
15
|
+
it 'should call NATGatewaysApi.datacenters_natgateways_find_by_nat_gateway_id' do
|
16
|
+
natgateway = natgateway_mock
|
17
|
+
subject_config = {
|
18
|
+
ionoscloud_username: 'email',
|
19
|
+
ionoscloud_password: 'password',
|
20
|
+
datacenter_id: 'datacenter_id',
|
21
|
+
natgateway_id: natgateway.id,
|
22
|
+
yes: true,
|
23
|
+
}
|
24
|
+
|
25
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
26
|
+
|
27
|
+
expect(subject).to receive(:puts).with("ID: #{natgateway.id}")
|
28
|
+
expect(subject).to receive(:puts).with("Name: #{natgateway.properties.name}")
|
29
|
+
expect(subject).to receive(:puts).with("IPS: #{natgateway.properties.public_ips}")
|
30
|
+
expect(subject).to receive(:puts).with("LANS: #{natgateway.properties.lans.map { |el| { id: el.id, gateway_ips: el.gateway_ips } }}")
|
31
|
+
expect(subject).to receive(:puts).with("Rules: #{natgateway.entities.rules.items.map do |el|
|
32
|
+
{
|
33
|
+
id: el.id,
|
34
|
+
name: el.properties.name,
|
35
|
+
type: el.properties.type,
|
36
|
+
protocol: el.properties.protocol,
|
37
|
+
public_ip: el.properties.public_ip,
|
38
|
+
source_subnet: el.properties.source_subnet,
|
39
|
+
target_subnet: el.properties.target_subnet,
|
40
|
+
target_port_range_start: el.properties.target_port_range ? el.properties.target_port_range.start : '',
|
41
|
+
target_port_range_end: el.properties.target_port_range ? el.properties.target_port_range._end : '',
|
42
|
+
}
|
43
|
+
end}")
|
44
|
+
expect(subject).to receive(:puts).with("Flowlogs: #{natgateway.entities.flowlogs.items.map { |flowlog| flowlog.id }}")
|
45
|
+
|
46
|
+
expect(subject.api_client).not_to receive(:wait_for)
|
47
|
+
mock_call_api(
|
48
|
+
subject,
|
49
|
+
[
|
50
|
+
{
|
51
|
+
method: 'GET',
|
52
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{subject_config[:natgateway_id]}",
|
53
|
+
operation: :'NATGatewaysApi.datacenters_natgateways_find_by_nat_gateway_id',
|
54
|
+
return_type: 'NatGateway',
|
55
|
+
result: natgateway,
|
56
|
+
},
|
57
|
+
],
|
58
|
+
)
|
59
|
+
|
60
|
+
expect { subject.run }.not_to raise_error(Exception)
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'should not make any call if any required option is missing' do
|
64
|
+
required_options = subject.instance_variable_get(:@required_options)
|
65
|
+
|
66
|
+
arrays_without_one_element(required_options).each do |test_case|
|
67
|
+
|
68
|
+
test_case[:array].each { |value| subject.config[value] = 'test' }
|
69
|
+
|
70
|
+
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
71
|
+
expect(subject.api_client).not_to receive(:call_api)
|
72
|
+
|
73
|
+
expect { subject.run }.to raise_error(SystemExit) do |error|
|
74
|
+
expect(error.status).to eq(1)
|
75
|
+
end
|
76
|
+
|
77
|
+
required_options.each { |value| subject.config[value] = nil }
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,158 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ionoscloud_natgateway_lan_add'
|
3
|
+
|
4
|
+
Chef::Knife::IonoscloudNatgatewayLanAdd.load_deps
|
5
|
+
|
6
|
+
describe Chef::Knife::IonoscloudNatgatewayLanAdd do
|
7
|
+
before :each do
|
8
|
+
subject { Chef::Knife::IonoscloudNatgatewayLanAdd.new }
|
9
|
+
|
10
|
+
allow(subject).to receive(:puts)
|
11
|
+
allow(subject).to receive(:print)
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#run' do
|
15
|
+
it 'should call NATGatewaysApi.datacenters_natgateways_patch and add a new lan when need' do
|
16
|
+
natgateway = natgateway_mock
|
17
|
+
lan = natgateway_lan_mock(lan_id: 2, gateway_ips: ['0.8.152.237/24'])
|
18
|
+
subject_config = {
|
19
|
+
ionoscloud_username: 'email',
|
20
|
+
ionoscloud_password: 'password',
|
21
|
+
datacenter_id: 'datacenter_id',
|
22
|
+
natgateway_id: natgateway.id,
|
23
|
+
lan_id: lan.id,
|
24
|
+
gateway_ips: lan.gateway_ips.join(','),
|
25
|
+
yes: true,
|
26
|
+
}
|
27
|
+
|
28
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
29
|
+
|
30
|
+
|
31
|
+
expect(subject).to receive(:puts).with("ID: #{natgateway.id}")
|
32
|
+
expect(subject).to receive(:puts).with("Name: #{natgateway.properties.name}")
|
33
|
+
expect(subject).to receive(:puts).with("IPS: #{natgateway.properties.public_ips}")
|
34
|
+
expect(subject).to receive(:puts).with("LANS: #{(natgateway.properties.lans + [lan]).map { |el| { id: el.id, gateway_ips: el.gateway_ips } }}")
|
35
|
+
expect(subject).to receive(:puts).with("Rules: #{natgateway.entities.rules.items.map do |el|
|
36
|
+
{
|
37
|
+
id: el.id,
|
38
|
+
name: el.properties.name,
|
39
|
+
type: el.properties.type,
|
40
|
+
protocol: el.properties.protocol,
|
41
|
+
public_ip: el.properties.public_ip,
|
42
|
+
source_subnet: el.properties.source_subnet,
|
43
|
+
target_subnet: el.properties.target_subnet,
|
44
|
+
target_port_range_start: el.properties.target_port_range ? el.properties.target_port_range.start : '',
|
45
|
+
target_port_range_end: el.properties.target_port_range ? el.properties.target_port_range._end : '',
|
46
|
+
}
|
47
|
+
end}")
|
48
|
+
expect(subject).to receive(:puts).with("Flowlogs: #{natgateway.entities.flowlogs.items.map { |flowlog| flowlog.id }}")
|
49
|
+
|
50
|
+
expected_properties = natgateway.properties.to_hash
|
51
|
+
expected_properties[:lans] << lan.to_hash
|
52
|
+
|
53
|
+
mock_wait_for(subject)
|
54
|
+
mock_call_api(
|
55
|
+
subject,
|
56
|
+
[
|
57
|
+
{
|
58
|
+
method: 'GET',
|
59
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{natgateway.id}",
|
60
|
+
operation: :'NATGatewaysApi.datacenters_natgateways_find_by_nat_gateway_id',
|
61
|
+
return_type: 'NatGateway',
|
62
|
+
result: natgateway,
|
63
|
+
},
|
64
|
+
{
|
65
|
+
method: 'PATCH',
|
66
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{natgateway.id}",
|
67
|
+
operation: :'NATGatewaysApi.datacenters_natgateways_patch',
|
68
|
+
body: expected_properties,
|
69
|
+
return_type: 'NatGateway',
|
70
|
+
result: natgateway,
|
71
|
+
},
|
72
|
+
{
|
73
|
+
method: 'GET',
|
74
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{natgateway.id}",
|
75
|
+
operation: :'NATGatewaysApi.datacenters_natgateways_find_by_nat_gateway_id',
|
76
|
+
return_type: 'NatGateway',
|
77
|
+
result: natgateway,
|
78
|
+
},
|
79
|
+
],
|
80
|
+
)
|
81
|
+
|
82
|
+
expect { subject.run }.not_to raise_error(Exception)
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'should call NATGatewaysApi.datacenters_natgateways_patch and update an existing lan when need' do
|
86
|
+
natgateway = natgateway_mock
|
87
|
+
lan = natgateway_lan_mock(lan_id: 1, gateway_ips: ['0.8.152.237/24'])
|
88
|
+
subject_config = {
|
89
|
+
ionoscloud_username: 'email',
|
90
|
+
ionoscloud_password: 'password',
|
91
|
+
datacenter_id: 'datacenter_id',
|
92
|
+
natgateway_id: natgateway.id,
|
93
|
+
lan_id: lan.id,
|
94
|
+
gateway_ips: lan.gateway_ips.join(','),
|
95
|
+
yes: true,
|
96
|
+
}
|
97
|
+
|
98
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
99
|
+
|
100
|
+
expect(subject).to receive(:puts).with("ID: #{natgateway.id}")
|
101
|
+
expect(subject).to receive(:puts).with("Name: #{natgateway.properties.name}")
|
102
|
+
expect(subject).to receive(:puts).with("IPS: #{natgateway.properties.public_ips}")
|
103
|
+
expect(subject).to receive(:puts).with("LANS: #{[{ id: lan.id, gateway_ips: lan.gateway_ips }]}")
|
104
|
+
|
105
|
+
expected_properties = natgateway.properties.to_hash
|
106
|
+
expected_properties[:lans] = [lan.to_hash]
|
107
|
+
|
108
|
+
mock_wait_for(subject)
|
109
|
+
mock_call_api(
|
110
|
+
subject,
|
111
|
+
[
|
112
|
+
{
|
113
|
+
method: 'GET',
|
114
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{natgateway.id}",
|
115
|
+
operation: :'NATGatewaysApi.datacenters_natgateways_find_by_nat_gateway_id',
|
116
|
+
return_type: 'NatGateway',
|
117
|
+
result: natgateway,
|
118
|
+
},
|
119
|
+
{
|
120
|
+
method: 'PATCH',
|
121
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{natgateway.id}",
|
122
|
+
operation: :'NATGatewaysApi.datacenters_natgateways_patch',
|
123
|
+
body: expected_properties,
|
124
|
+
return_type: 'NatGateway',
|
125
|
+
result: natgateway,
|
126
|
+
},
|
127
|
+
{
|
128
|
+
method: 'GET',
|
129
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{natgateway.id}",
|
130
|
+
operation: :'NATGatewaysApi.datacenters_natgateways_find_by_nat_gateway_id',
|
131
|
+
return_type: 'NatGateway',
|
132
|
+
result: natgateway,
|
133
|
+
},
|
134
|
+
],
|
135
|
+
)
|
136
|
+
|
137
|
+
expect { subject.run }.not_to raise_error(Exception)
|
138
|
+
end
|
139
|
+
|
140
|
+
it 'should not make any call if any required option is missing' do
|
141
|
+
required_options = subject.instance_variable_get(:@required_options)
|
142
|
+
|
143
|
+
arrays_without_one_element(required_options).each do |test_case|
|
144
|
+
|
145
|
+
test_case[:array].each { |value| subject.config[value] = 'test' }
|
146
|
+
|
147
|
+
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
148
|
+
expect(subject.api_client).not_to receive(:call_api)
|
149
|
+
|
150
|
+
expect { subject.run }.to raise_error(SystemExit) do |error|
|
151
|
+
expect(error.status).to eq(1)
|
152
|
+
end
|
153
|
+
|
154
|
+
required_options.each { |value| subject.config[value] = nil }
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
@@ -0,0 +1,209 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ionoscloud_natgateway_lan_remove'
|
3
|
+
|
4
|
+
Chef::Knife::IonoscloudNatgatewayLanRemove.load_deps
|
5
|
+
|
6
|
+
describe Chef::Knife::IonoscloudNatgatewayLanRemove do
|
7
|
+
before :each do
|
8
|
+
subject { Chef::Knife::IonoscloudNatgatewayLanRemove.new }
|
9
|
+
|
10
|
+
allow(subject).to receive(:puts)
|
11
|
+
allow(subject).to receive(:print)
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#run' do
|
15
|
+
it 'should call NATGatewaysApi.datacenters_natgateways_patch and remove lans' do
|
16
|
+
natgateway = natgateway_mock
|
17
|
+
subject_config = {
|
18
|
+
ionoscloud_username: 'email',
|
19
|
+
ionoscloud_password: 'password',
|
20
|
+
datacenter_id: 'datacenter_id',
|
21
|
+
natgateway_id: natgateway.id,
|
22
|
+
yes: true,
|
23
|
+
}
|
24
|
+
|
25
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
26
|
+
subject.name_args = natgateway.properties.lans.map { |el| el.id }
|
27
|
+
|
28
|
+
|
29
|
+
expect(subject).to receive(:puts).with("ID: #{natgateway.id}")
|
30
|
+
expect(subject).to receive(:puts).with("Name: #{natgateway.properties.name}")
|
31
|
+
expect(subject).to receive(:puts).with("IPS: #{natgateway.properties.public_ips}")
|
32
|
+
expect(subject).to receive(:puts).with("LANS: #{[]}")
|
33
|
+
expect(subject).to receive(:puts).with("Rules: #{natgateway.entities.rules.items.map do |el|
|
34
|
+
{
|
35
|
+
id: el.id,
|
36
|
+
name: el.properties.name,
|
37
|
+
type: el.properties.type,
|
38
|
+
protocol: el.properties.protocol,
|
39
|
+
public_ip: el.properties.public_ip,
|
40
|
+
source_subnet: el.properties.source_subnet,
|
41
|
+
target_subnet: el.properties.target_subnet,
|
42
|
+
target_port_range_start: el.properties.target_port_range ? el.properties.target_port_range.start : '',
|
43
|
+
target_port_range_end: el.properties.target_port_range ? el.properties.target_port_range._end : '',
|
44
|
+
}
|
45
|
+
end}")
|
46
|
+
expect(subject).to receive(:puts).with("Flowlogs: #{natgateway.entities.flowlogs.items.map { |flowlog| flowlog.id }}")
|
47
|
+
|
48
|
+
expected_properties = natgateway.properties.to_hash
|
49
|
+
expected_properties[:lans] = []
|
50
|
+
|
51
|
+
mock_wait_for(subject)
|
52
|
+
mock_call_api(
|
53
|
+
subject,
|
54
|
+
[
|
55
|
+
{
|
56
|
+
method: 'GET',
|
57
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{natgateway.id}",
|
58
|
+
operation: :'NATGatewaysApi.datacenters_natgateways_find_by_nat_gateway_id',
|
59
|
+
return_type: 'NatGateway',
|
60
|
+
result: natgateway,
|
61
|
+
},
|
62
|
+
{
|
63
|
+
method: 'PATCH',
|
64
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{natgateway.id}",
|
65
|
+
operation: :'NATGatewaysApi.datacenters_natgateways_patch',
|
66
|
+
body: expected_properties,
|
67
|
+
return_type: 'NatGateway',
|
68
|
+
result: natgateway,
|
69
|
+
},
|
70
|
+
{
|
71
|
+
method: 'GET',
|
72
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{natgateway.id}",
|
73
|
+
operation: :'NATGatewaysApi.datacenters_natgateways_find_by_nat_gateway_id',
|
74
|
+
return_type: 'NatGateway',
|
75
|
+
result: natgateway,
|
76
|
+
},
|
77
|
+
],
|
78
|
+
)
|
79
|
+
|
80
|
+
expect { subject.run }.not_to raise_error(Exception)
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'should call NATGatewaysApi.datacenters_natgateways_patch and remove only wanted lans' do
|
84
|
+
lan1 = natgateway_lan_mock(lan_id: 1)
|
85
|
+
lan2 = natgateway_lan_mock(lan_id: 4)
|
86
|
+
lan3 = natgateway_lan_mock(lan_id: 3)
|
87
|
+
natgateway = natgateway_mock(lans: [lan1, lan2])
|
88
|
+
subject_config = {
|
89
|
+
ionoscloud_username: 'email',
|
90
|
+
ionoscloud_password: 'password',
|
91
|
+
datacenter_id: 'datacenter_id',
|
92
|
+
natgateway_id: natgateway.id,
|
93
|
+
yes: true,
|
94
|
+
}
|
95
|
+
|
96
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
97
|
+
subject.name_args = [lan3.id]
|
98
|
+
|
99
|
+
expect(subject).to receive(:puts).with("ID: #{natgateway.id}")
|
100
|
+
expect(subject).to receive(:puts).with("Name: #{natgateway.properties.name}")
|
101
|
+
expect(subject).to receive(:puts).with("IPS: #{natgateway.properties.public_ips}")
|
102
|
+
expect(subject).to receive(:puts).with("LANS: #{natgateway.properties.lans.map { |el| { id: el.id, gateway_ips: el.gateway_ips } }}")
|
103
|
+
|
104
|
+
expected_properties = natgateway.properties.to_hash
|
105
|
+
|
106
|
+
mock_wait_for(subject)
|
107
|
+
mock_call_api(
|
108
|
+
subject,
|
109
|
+
[
|
110
|
+
{
|
111
|
+
method: 'GET',
|
112
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{natgateway.id}",
|
113
|
+
operation: :'NATGatewaysApi.datacenters_natgateways_find_by_nat_gateway_id',
|
114
|
+
return_type: 'NatGateway',
|
115
|
+
result: natgateway,
|
116
|
+
},
|
117
|
+
{
|
118
|
+
method: 'PATCH',
|
119
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{natgateway.id}",
|
120
|
+
operation: :'NATGatewaysApi.datacenters_natgateways_patch',
|
121
|
+
body: expected_properties,
|
122
|
+
return_type: 'NatGateway',
|
123
|
+
result: natgateway,
|
124
|
+
},
|
125
|
+
{
|
126
|
+
method: 'GET',
|
127
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{natgateway.id}",
|
128
|
+
operation: :'NATGatewaysApi.datacenters_natgateways_find_by_nat_gateway_id',
|
129
|
+
return_type: 'NatGateway',
|
130
|
+
result: natgateway,
|
131
|
+
},
|
132
|
+
],
|
133
|
+
)
|
134
|
+
expect { subject.run }.not_to raise_error(Exception)
|
135
|
+
end
|
136
|
+
|
137
|
+
it 'should call NATGatewaysApi.datacenters_natgateways_patch and remove only wanted lans 2' do
|
138
|
+
lan1 = natgateway_lan_mock(lan_id: 1)
|
139
|
+
lan2 = natgateway_lan_mock(lan_id: 4)
|
140
|
+
natgateway = natgateway_mock(lans: [lan1, lan2])
|
141
|
+
subject_config = {
|
142
|
+
ionoscloud_username: 'email',
|
143
|
+
ionoscloud_password: 'password',
|
144
|
+
datacenter_id: 'datacenter_id',
|
145
|
+
natgateway_id: natgateway.id,
|
146
|
+
yes: true,
|
147
|
+
}
|
148
|
+
|
149
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
150
|
+
subject.name_args = [lan2.id]
|
151
|
+
|
152
|
+
expect(subject).to receive(:puts).with("ID: #{natgateway.id}")
|
153
|
+
expect(subject).to receive(:puts).with("Name: #{natgateway.properties.name}")
|
154
|
+
expect(subject).to receive(:puts).with("IPS: #{natgateway.properties.public_ips}")
|
155
|
+
expect(subject).to receive(:puts).with("LANS: #{[{ id: lan1.id, gateway_ips: lan1.gateway_ips }]}")
|
156
|
+
|
157
|
+
expected_properties = natgateway.properties.to_hash
|
158
|
+
expected_properties[:lans] = [lan1.to_hash]
|
159
|
+
|
160
|
+
mock_wait_for(subject)
|
161
|
+
mock_call_api(
|
162
|
+
subject,
|
163
|
+
[
|
164
|
+
{
|
165
|
+
method: 'GET',
|
166
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{natgateway.id}",
|
167
|
+
operation: :'NATGatewaysApi.datacenters_natgateways_find_by_nat_gateway_id',
|
168
|
+
return_type: 'NatGateway',
|
169
|
+
result: natgateway,
|
170
|
+
},
|
171
|
+
{
|
172
|
+
method: 'PATCH',
|
173
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{natgateway.id}",
|
174
|
+
operation: :'NATGatewaysApi.datacenters_natgateways_patch',
|
175
|
+
body: expected_properties,
|
176
|
+
return_type: 'NatGateway',
|
177
|
+
result: natgateway,
|
178
|
+
},
|
179
|
+
{
|
180
|
+
method: 'GET',
|
181
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/natgateways/#{natgateway.id}",
|
182
|
+
operation: :'NATGatewaysApi.datacenters_natgateways_find_by_nat_gateway_id',
|
183
|
+
return_type: 'NatGateway',
|
184
|
+
result: natgateway,
|
185
|
+
},
|
186
|
+
],
|
187
|
+
)
|
188
|
+
expect { subject.run }.not_to raise_error(Exception)
|
189
|
+
end
|
190
|
+
|
191
|
+
it 'should not make any call if any required option is missing' do
|
192
|
+
required_options = subject.instance_variable_get(:@required_options)
|
193
|
+
|
194
|
+
arrays_without_one_element(required_options).each do |test_case|
|
195
|
+
|
196
|
+
test_case[:array].each { |value| subject.config[value] = 'test' }
|
197
|
+
|
198
|
+
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
199
|
+
expect(subject.api_client).not_to receive(:call_api)
|
200
|
+
|
201
|
+
expect { subject.run }.to raise_error(SystemExit) do |error|
|
202
|
+
expect(error.status).to eq(1)
|
203
|
+
end
|
204
|
+
|
205
|
+
required_options.each { |value| subject.config[value] = nil }
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|