knife-ionoscloud 5.0.0.beta.1 → 5.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +20 -0
- data/.github/workflows/ci.yml +4 -4
- data/.github/workflows/publish.yml +28 -14
- data/.rubocop.yml +0 -1
- data/README.md +81 -0
- data/docs/README.md +52 -18
- data/docs/changelog.md +2 -1
- data/docs/docs_generator.rb +2 -2
- data/docs/subcommands/backupunit_create.md +14 -9
- data/docs/subcommands/backupunit_delete.md +13 -8
- data/docs/subcommands/backupunit_get.md +35 -0
- data/docs/subcommands/backupunit_list.md +13 -8
- data/docs/subcommands/backupunit_ssourl.md +15 -10
- data/docs/subcommands/backupunit_update.md +41 -0
- data/docs/subcommands/composite_server_create.md +14 -9
- data/docs/subcommands/contract_list.md +13 -8
- data/docs/subcommands/datacenter_create.md +16 -9
- data/docs/subcommands/datacenter_delete.md +13 -8
- data/docs/subcommands/datacenter_get.md +35 -0
- data/docs/subcommands/datacenter_list.md +13 -8
- data/docs/subcommands/datacenter_update.md +44 -0
- data/docs/subcommands/firewall_create.md +17 -12
- data/docs/subcommands/firewall_delete.md +16 -11
- data/docs/subcommands/firewall_get.md +47 -0
- data/docs/subcommands/firewall_list.md +16 -11
- data/docs/subcommands/firewall_update.md +71 -0
- data/docs/subcommands/group_create.md +22 -8
- data/docs/subcommands/group_delete.md +13 -8
- data/docs/subcommands/group_get.md +14 -9
- data/docs/subcommands/group_list.md +13 -8
- data/docs/subcommands/group_update.md +65 -0
- data/docs/subcommands/group_user_add.md +14 -9
- data/docs/subcommands/group_user_remove.md +14 -9
- data/docs/subcommands/image_list.md +13 -8
- data/docs/subcommands/ipblock_create.md +14 -9
- data/docs/subcommands/ipblock_delete.md +13 -8
- data/docs/subcommands/ipblock_get.md +35 -0
- data/docs/subcommands/ipblock_list.md +13 -8
- data/docs/subcommands/ipblock_update.md +38 -0
- data/docs/subcommands/ipfailover_add.md +16 -11
- data/docs/subcommands/ipfailover_remove.md +16 -11
- data/docs/subcommands/k8s_create.md +23 -9
- data/docs/subcommands/k8s_delete.md +13 -8
- data/docs/subcommands/k8s_get.md +35 -0
- data/docs/subcommands/k8s_list.md +13 -8
- data/docs/subcommands/k8s_update.md +53 -0
- data/docs/subcommands/kubeconfig_get.md +14 -9
- data/docs/subcommands/label_add.md +14 -9
- data/docs/subcommands/label_list.md +13 -8
- data/docs/subcommands/label_remove.md +14 -9
- data/docs/subcommands/lan_create.md +17 -9
- data/docs/subcommands/lan_delete.md +14 -9
- data/docs/subcommands/lan_get.md +39 -0
- data/docs/subcommands/lan_list.md +14 -9
- data/docs/subcommands/lan_update.md +51 -0
- data/docs/subcommands/loadbalancer_create.md +15 -10
- data/docs/subcommands/loadbalancer_delete.md +14 -9
- data/docs/subcommands/loadbalancer_get.md +15 -10
- data/docs/subcommands/loadbalancer_list.md +14 -9
- data/docs/subcommands/loadbalancer_nic_add.md +15 -10
- data/docs/subcommands/loadbalancer_nic_remove.md +15 -10
- data/docs/subcommands/loadbalancer_update.md +48 -0
- data/docs/subcommands/location_list.md +13 -8
- data/docs/subcommands/nic_create.md +18 -14
- data/docs/subcommands/nic_delete.md +16 -11
- data/docs/subcommands/nic_get.md +43 -0
- data/docs/subcommands/nic_list.md +15 -10
- data/docs/subcommands/nic_update.md +58 -0
- data/docs/subcommands/node_delete.md +15 -10
- data/docs/subcommands/node_get.md +43 -0
- data/docs/subcommands/node_list.md +15 -10
- data/docs/subcommands/node_replace.md +16 -11
- data/docs/subcommands/nodepool_create.md +34 -20
- data/docs/subcommands/nodepool_delete.md +14 -9
- data/docs/subcommands/nodepool_get.md +39 -0
- data/docs/subcommands/nodepool_list.md +14 -9
- data/docs/subcommands/nodepool_update.md +69 -0
- data/docs/subcommands/pcc_create.md +14 -12
- data/docs/subcommands/pcc_delete.md +13 -8
- data/docs/subcommands/pcc_get.md +35 -0
- data/docs/subcommands/pcc_list.md +13 -8
- data/docs/subcommands/pcc_update.md +41 -0
- data/docs/subcommands/request_get.md +35 -0
- data/docs/subcommands/request_list.md +21 -10
- data/docs/subcommands/request_status.md +14 -9
- data/docs/subcommands/request_wait.md +14 -9
- data/docs/subcommands/resource_list.md +13 -8
- data/docs/subcommands/s3key_create.md +14 -9
- data/docs/subcommands/s3key_delete.md +14 -9
- data/docs/subcommands/s3key_get.md +39 -0
- data/docs/subcommands/s3key_list.md +14 -9
- data/docs/subcommands/server_create.md +15 -10
- data/docs/subcommands/server_delete.md +15 -10
- data/docs/subcommands/server_get.md +39 -0
- data/docs/subcommands/server_list.md +14 -9
- data/docs/subcommands/server_reboot.md +14 -9
- data/docs/subcommands/server_start.md +15 -10
- data/docs/subcommands/server_stop.md +14 -9
- data/docs/subcommands/server_update.md +60 -0
- data/docs/subcommands/share_create.md +16 -11
- data/docs/subcommands/share_delete.md +14 -9
- data/docs/subcommands/share_get.md +39 -0
- data/docs/subcommands/share_list.md +14 -9
- data/docs/subcommands/share_update.md +45 -0
- data/docs/subcommands/snapshot_create.md +27 -10
- data/docs/subcommands/snapshot_delete.md +13 -8
- data/docs/subcommands/snapshot_get.md +35 -0
- data/docs/subcommands/snapshot_list.md +13 -8
- data/docs/subcommands/snapshot_restore.md +16 -11
- data/docs/subcommands/snapshot_update.md +77 -0
- data/docs/subcommands/user_create.md +22 -12
- data/docs/subcommands/user_delete.md +13 -8
- data/docs/subcommands/user_get.md +35 -0
- data/docs/subcommands/user_list.md +14 -9
- data/docs/subcommands/user_ssourl.md +14 -9
- data/docs/subcommands/user_update.md +56 -0
- data/docs/subcommands/volume_attach.md +15 -10
- data/docs/subcommands/volume_create.md +38 -9
- data/docs/subcommands/volume_delete.md +14 -9
- data/docs/subcommands/volume_detach.md +15 -10
- data/docs/subcommands/volume_get.md +39 -0
- data/docs/subcommands/volume_list.md +14 -9
- data/docs/subcommands/volume_update.md +66 -0
- data/docs/summary.md +33 -0
- data/docs/templates/subcommand_doc.mustache +9 -7
- data/git-versioning.sh +113 -0
- data/lib/chef/knife/ionoscloud_backupunit_create.rb +11 -15
- data/lib/chef/knife/ionoscloud_backupunit_delete.rb +2 -4
- data/lib/chef/knife/ionoscloud_backupunit_get.rb +33 -0
- data/lib/chef/knife/ionoscloud_backupunit_list.rb +1 -0
- data/lib/chef/knife/ionoscloud_backupunit_ssourl.rb +2 -1
- data/lib/chef/knife/ionoscloud_backupunit_update.rb +62 -0
- data/lib/chef/knife/ionoscloud_base.rb +258 -5
- data/lib/chef/knife/ionoscloud_composite_server_create.rb +4 -31
- data/lib/chef/knife/ionoscloud_contract_list.rb +1 -0
- data/lib/chef/knife/ionoscloud_datacenter_create.rb +12 -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 -1
- data/lib/chef/knife/ionoscloud_datacenter_update.rb +67 -0
- data/lib/chef/knife/ionoscloud_firewall_create.rb +3 -13
- data/lib/chef/knife/ionoscloud_firewall_delete.rb +3 -10
- data/lib/chef/knife/ionoscloud_firewall_get.rb +50 -0
- data/lib/chef/knife/ionoscloud_firewall_list.rb +1 -0
- data/lib/chef/knife/ionoscloud_firewall_update.rb +131 -0
- data/lib/chef/knife/ionoscloud_group_create.rb +30 -21
- data/lib/chef/knife/ionoscloud_group_delete.rb +2 -11
- data/lib/chef/knife/ionoscloud_group_get.rb +2 -11
- data/lib/chef/knife/ionoscloud_group_list.rb +14 -7
- data/lib/chef/knife/ionoscloud_group_update.rb +114 -0
- data/lib/chef/knife/ionoscloud_group_user_add.rb +2 -13
- data/lib/chef/knife/ionoscloud_group_user_remove.rb +2 -13
- data/lib/chef/knife/ionoscloud_image_list.rb +4 -3
- data/lib/chef/knife/ionoscloud_ipblock_create.rb +12 -14
- data/lib/chef/knife/ionoscloud_ipblock_delete.rb +3 -4
- data/lib/chef/knife/ionoscloud_ipblock_get.rb +33 -0
- data/lib/chef/knife/ionoscloud_ipblock_list.rb +4 -1
- data/lib/chef/knife/ionoscloud_ipblock_update.rb +57 -0
- data/lib/chef/knife/ionoscloud_ipfailover_add.rb +8 -14
- data/lib/chef/knife/ionoscloud_ipfailover_remove.rb +2 -8
- data/lib/chef/knife/ionoscloud_k8s_create.rb +34 -18
- data/lib/chef/knife/ionoscloud_k8s_delete.rb +7 -11
- data/lib/chef/knife/ionoscloud_k8s_get.rb +33 -0
- data/lib/chef/knife/ionoscloud_k8s_list.rb +1 -0
- data/lib/chef/knife/ionoscloud_k8s_update.rb +99 -0
- data/lib/chef/knife/ionoscloud_kubeconfig_get.rb +1 -0
- data/lib/chef/knife/ionoscloud_label_add.rb +1 -0
- data/lib/chef/knife/ionoscloud_label_list.rb +1 -0
- data/lib/chef/knife/ionoscloud_label_remove.rb +1 -0
- data/lib/chef/knife/ionoscloud_lan_create.rb +11 -12
- data/lib/chef/knife/ionoscloud_lan_delete.rb +3 -3
- data/lib/chef/knife/ionoscloud_lan_get.rb +38 -0
- data/lib/chef/knife/ionoscloud_lan_list.rb +6 -1
- data/lib/chef/knife/ionoscloud_lan_update.rb +87 -0
- data/lib/chef/knife/ionoscloud_loadbalancer_create.rb +6 -15
- data/lib/chef/knife/ionoscloud_loadbalancer_delete.rb +2 -9
- data/lib/chef/knife/ionoscloud_loadbalancer_get.rb +4 -13
- data/lib/chef/knife/ionoscloud_loadbalancer_list.rb +1 -0
- data/lib/chef/knife/ionoscloud_loadbalancer_nic_add.rb +4 -13
- data/lib/chef/knife/ionoscloud_loadbalancer_nic_remove.rb +4 -13
- data/lib/chef/knife/ionoscloud_loadbalancer_update.rb +73 -0
- data/lib/chef/knife/ionoscloud_location_list.rb +1 -0
- data/lib/chef/knife/ionoscloud_nic_create.rb +17 -32
- data/lib/chef/knife/ionoscloud_nic_delete.rb +4 -8
- data/lib/chef/knife/ionoscloud_nic_get.rb +47 -0
- data/lib/chef/knife/ionoscloud_nic_list.rb +1 -0
- data/lib/chef/knife/ionoscloud_nic_update.rb +93 -0
- data/lib/chef/knife/ionoscloud_node_delete.rb +2 -6
- data/lib/chef/knife/ionoscloud_node_get.rb +47 -0
- data/lib/chef/knife/ionoscloud_node_list.rb +4 -1
- data/lib/chef/knife/ionoscloud_node_replace.rb +1 -0
- data/lib/chef/knife/ionoscloud_nodepool_create.rb +55 -51
- data/lib/chef/knife/ionoscloud_nodepool_delete.rb +2 -7
- data/lib/chef/knife/ionoscloud_nodepool_get.rb +41 -0
- data/lib/chef/knife/ionoscloud_nodepool_list.rb +1 -0
- data/lib/chef/knife/ionoscloud_nodepool_update.rb +124 -0
- data/lib/chef/knife/ionoscloud_pcc_create.rb +42 -20
- data/lib/chef/knife/ionoscloud_pcc_delete.rb +2 -9
- data/lib/chef/knife/ionoscloud_pcc_get.rb +33 -0
- data/lib/chef/knife/ionoscloud_pcc_list.rb +1 -0
- 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 +25 -11
- data/lib/chef/knife/ionoscloud_request_status.rb +1 -0
- data/lib/chef/knife/ionoscloud_request_wait.rb +1 -0
- data/lib/chef/knife/ionoscloud_resource_list.rb +1 -0
- data/lib/chef/knife/ionoscloud_s3key_create.rb +2 -5
- data/lib/chef/knife/ionoscloud_s3key_delete.rb +2 -4
- data/lib/chef/knife/ionoscloud_s3key_get.rb +38 -0
- data/lib/chef/knife/ionoscloud_s3key_list.rb +1 -0
- data/lib/chef/knife/ionoscloud_server_create.rb +14 -25
- data/lib/chef/knife/ionoscloud_server_delete.rb +3 -10
- data/lib/chef/knife/ionoscloud_server_get.rb +41 -0
- data/lib/chef/knife/ionoscloud_server_list.rb +3 -2
- data/lib/chef/knife/ionoscloud_server_reboot.rb +1 -0
- data/lib/chef/knife/ionoscloud_server_start.rb +1 -0
- data/lib/chef/knife/ionoscloud_server_stop.rb +1 -0
- data/lib/chef/knife/ionoscloud_server_update.rb +97 -0
- data/lib/chef/knife/ionoscloud_share_create.rb +8 -12
- data/lib/chef/knife/ionoscloud_share_delete.rb +3 -4
- data/lib/chef/knife/ionoscloud_share_get.rb +38 -0
- data/lib/chef/knife/ionoscloud_share_list.rb +1 -0
- data/lib/chef/knife/ionoscloud_share_update.rb +70 -0
- data/lib/chef/knife/ionoscloud_snapshot_create.rb +26 -9
- data/lib/chef/knife/ionoscloud_snapshot_delete.rb +2 -6
- data/lib/chef/knife/ionoscloud_snapshot_get.rb +32 -0
- data/lib/chef/knife/ionoscloud_snapshot_list.rb +1 -0
- data/lib/chef/knife/ionoscloud_snapshot_restore.rb +1 -0
- data/lib/chef/knife/ionoscloud_snapshot_update.rb +126 -0
- data/lib/chef/knife/ionoscloud_user_create.rb +28 -23
- data/lib/chef/knife/ionoscloud_user_delete.rb +2 -7
- data/lib/chef/knife/ionoscloud_user_get.rb +32 -0
- data/lib/chef/knife/ionoscloud_user_list.rb +2 -1
- data/lib/chef/knife/ionoscloud_user_ssourl.rb +1 -0
- data/lib/chef/knife/ionoscloud_user_update.rb +92 -0
- data/lib/chef/knife/ionoscloud_volume_attach.rb +1 -0
- data/lib/chef/knife/ionoscloud_volume_create.rb +62 -38
- data/lib/chef/knife/ionoscloud_volume_delete.rb +2 -8
- data/lib/chef/knife/ionoscloud_volume_detach.rb +2 -8
- data/lib/chef/knife/ionoscloud_volume_get.rb +36 -0
- data/lib/chef/knife/ionoscloud_volume_list.rb +2 -1
- data/lib/chef/knife/ionoscloud_volume_update.rb +106 -0
- data/lib/knife-ionoscloud/version.rb +1 -1
- data/sonar-project.properties +12 -0
- data/spec/chef/knife/ionoscloud_backupunit_get_spec.rb +65 -0
- data/spec/chef/knife/ionoscloud_backupunit_update_spec.rb +78 -0
- data/spec/chef/knife/ionoscloud_datacenter_create_spec.rb +10 -0
- data/spec/chef/knife/ionoscloud_datacenter_delete_spec.rb +3 -0
- data/spec/chef/knife/ionoscloud_datacenter_get_spec.rb +69 -0
- data/spec/chef/knife/ionoscloud_datacenter_list_spec.rb +3 -1
- data/spec/chef/knife/ionoscloud_datacenter_update_spec.rb +82 -0
- data/spec/chef/knife/ionoscloud_firewall_get_spec.rb +76 -0
- data/spec/chef/knife/ionoscloud_firewall_update_spec.rb +116 -0
- data/spec/chef/knife/ionoscloud_group_create_spec.rb +13 -0
- 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 +17 -8
- data/spec/chef/knife/ionoscloud_group_update_spec.rb +109 -0
- 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 +2 -0
- data/spec/chef/knife/ionoscloud_ipblock_get_spec.rb +66 -0
- data/spec/chef/knife/ionoscloud_ipblock_list_spec.rb +3 -1
- data/spec/chef/knife/ionoscloud_ipblock_update_spec.rb +79 -0
- data/spec/chef/knife/ionoscloud_ipfailover_add_spec.rb +2 -1
- data/spec/chef/knife/ionoscloud_ipfailover_remove_spec.rb +4 -3
- data/spec/chef/knife/ionoscloud_k8s_create_spec.rb +8 -0
- data/spec/chef/knife/ionoscloud_k8s_delete_spec.rb +12 -3
- data/spec/chef/knife/ionoscloud_k8s_get_spec.rb +73 -0
- data/spec/chef/knife/ionoscloud_k8s_update_spec.rb +115 -0
- data/spec/chef/knife/ionoscloud_lan_create_spec.rb +3 -0
- data/spec/chef/knife/ionoscloud_lan_delete_spec.rb +2 -0
- data/spec/chef/knife/ionoscloud_lan_get_spec.rb +68 -0
- data/spec/chef/knife/ionoscloud_lan_list_spec.rb +5 -1
- data/spec/chef/knife/ionoscloud_lan_update_spec.rb +91 -0
- data/spec/chef/knife/ionoscloud_loadbalancer_update_spec.rb +89 -0
- data/spec/chef/knife/ionoscloud_nic_get_spec.rb +70 -0
- data/spec/chef/knife/ionoscloud_nic_update_spec.rb +92 -0
- data/spec/chef/knife/ionoscloud_node_get_spec.rb +70 -0
- data/spec/chef/knife/ionoscloud_node_list_spec.rb +3 -1
- data/spec/chef/knife/ionoscloud_nodepool_create_spec.rb +13 -6
- data/spec/chef/knife/ionoscloud_nodepool_delete_spec.rb +27 -13
- data/spec/chef/knife/ionoscloud_nodepool_get_spec.rb +83 -0
- data/spec/chef/knife/ionoscloud_nodepool_update_spec.rb +130 -0
- data/spec/chef/knife/ionoscloud_pcc_create_spec.rb +39 -5
- data/spec/chef/knife/ionoscloud_pcc_delete_spec.rb +1 -1
- data/spec/chef/knife/ionoscloud_pcc_get_spec.rb +71 -0
- 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 +125 -5
- data/spec/chef/knife/ionoscloud_s3key_get_spec.rb +66 -0
- data/spec/chef/knife/ionoscloud_server_get_spec.rb +71 -0
- data/spec/chef/knife/ionoscloud_server_list_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_server_update_spec.rb +102 -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 +23 -0
- data/spec/chef/knife/ionoscloud_snapshot_delete_spec.rb +12 -0
- data/spec/chef/knife/ionoscloud_snapshot_get_spec.rb +79 -0
- data/spec/chef/knife/ionoscloud_snapshot_update_spec.rb +113 -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_update_spec.rb +110 -0
- data/spec/chef/knife/ionoscloud_volume_create_spec.rb +9 -52
- data/spec/chef/knife/ionoscloud_volume_delete_spec.rb +9 -0
- data/spec/chef/knife/ionoscloud_volume_detach_spec.rb +9 -0
- data/spec/chef/knife/ionoscloud_volume_get_spec.rb +80 -0
- data/spec/chef/knife/ionoscloud_volume_update_spec.rb +115 -0
- data/spec/spec_helper.rb +101 -56
- metadata +140 -4
@@ -25,7 +25,8 @@ class Chef
|
|
25
25
|
option :bus,
|
26
26
|
short: '-b BUS',
|
27
27
|
long: '--bus BUS',
|
28
|
-
description: 'The bus type of the volume (VIRTIO or IDE)'
|
28
|
+
description: 'The bus type of the volume (VIRTIO or IDE)',
|
29
|
+
default: 'VIRTIO'
|
29
30
|
|
30
31
|
option :image,
|
31
32
|
short: '-N ID',
|
@@ -59,8 +60,45 @@ class Chef
|
|
59
60
|
option :availability_zone,
|
60
61
|
short: '-Z AVAILABILITY_ZONE',
|
61
62
|
long: '--availability-zone AVAILABILITY_ZONE',
|
62
|
-
description: 'The volume availability zone of the server'
|
63
|
-
|
63
|
+
description: 'The volume availability zone of the server'
|
64
|
+
|
65
|
+
option :backupunit_id,
|
66
|
+
short: '-B BACKUPUNIT_ID',
|
67
|
+
long: '--backupunit BACKUPUNIT_ID',
|
68
|
+
description: 'The uuid of the Backup Unit that user has access to. The property is immutable and is only allowed '\
|
69
|
+
'to be set on a new volume creation. It is mandatory to provide either \'public image\' or \'imageAlias\' in '\
|
70
|
+
'conjunction with this property.'
|
71
|
+
|
72
|
+
option :user_data,
|
73
|
+
short: '-u USER_DATA',
|
74
|
+
long: '--user-data USER_DATA',
|
75
|
+
description: 'The cloud-init configuration for the volume as base64 encoded string. The property is '\
|
76
|
+
'immutable and is only allowed to be set on a new volume creation. It is mandatory to provide either \'public image\' '\
|
77
|
+
'or \'imageAlias\' that has cloud-init compatibility in conjunction with this property.'
|
78
|
+
|
79
|
+
option :cpu_hot_plug,
|
80
|
+
long: '--cpu-hot-plug CPU_HOT_PLUG',
|
81
|
+
description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
82
|
+
|
83
|
+
option :ram_hot_plug,
|
84
|
+
long: '--ram-hot-plug RAM_HOT_PLUG',
|
85
|
+
description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
86
|
+
|
87
|
+
option :nic_hot_plug,
|
88
|
+
long: '--nic-hot-plug NIC_HOT_PLUG',
|
89
|
+
description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
90
|
+
|
91
|
+
option :nic_hot_unplug,
|
92
|
+
long: '--nic-hot-unplug NIC_HOT_UNPLUG',
|
93
|
+
description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
94
|
+
|
95
|
+
option :disc_virtio_hot_plug,
|
96
|
+
long: '--disc-virtio-hot_plug DISC_VIRTIO_HOT_PLUG',
|
97
|
+
description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
98
|
+
|
99
|
+
option :disc_virtio_hot_unplug,
|
100
|
+
long: '--disc-virtio-hot_unplug DISC_VIRTIO_HOT_UNPLUG',
|
101
|
+
description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
64
102
|
|
65
103
|
attr_reader :description, :required_options
|
66
104
|
|
@@ -74,21 +112,10 @@ class Chef
|
|
74
112
|
|
75
113
|
def run
|
76
114
|
$stdout.sync = true
|
115
|
+
handle_extra_config
|
77
116
|
validate_required_params(@required_options, config)
|
78
117
|
|
79
|
-
if
|
80
|
-
ui.error('Either \'--image\' or \'--image-alias\' parameter must be provided')
|
81
|
-
exit(1)
|
82
|
-
end
|
83
|
-
|
84
|
-
if !config[:ssh_keys] && !config[:image_password]
|
85
|
-
ui.error('Either \'--image-password\' or \'--ssh-keys\' parameter must be provided')
|
86
|
-
exit(1)
|
87
|
-
end
|
88
|
-
|
89
|
-
if config[:ssh_keys]
|
90
|
-
config[:ssh_keys] = config[:ssh_keys].split(',')
|
91
|
-
end
|
118
|
+
config[:ssh_keys] = config[:ssh_keys].split(',') if config[:ssh_keys] && config[:ssh_keys].instance_of?(String)
|
92
119
|
|
93
120
|
print "#{ui.color('Creating volume...', :magenta)}"
|
94
121
|
|
@@ -96,37 +123,34 @@ class Chef
|
|
96
123
|
|
97
124
|
volume, _, headers = volume_api.datacenters_volumes_post_with_http_info(
|
98
125
|
config[:datacenter_id],
|
99
|
-
|
100
|
-
properties:
|
126
|
+
Ionoscloud::Volume.new(
|
127
|
+
properties: Ionoscloud::VolumeProperties.new(
|
101
128
|
name: config[:name],
|
102
129
|
size: config[:size],
|
103
|
-
bus: config[:bus]
|
130
|
+
bus: config[:bus],
|
104
131
|
type: config[:type],
|
105
|
-
|
132
|
+
licence_type: config[:licence_type],
|
106
133
|
image: config[:image],
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
134
|
+
image_alias: config[:image_alias],
|
135
|
+
ssh_keys: config[:ssh_keys],
|
136
|
+
image_password: config[:image_password],
|
137
|
+
availability_zone: config[:availability_zone],
|
138
|
+
backupunit_id: config[:backupunit_id],
|
139
|
+
user_data: config[:user_data],
|
140
|
+
cpu_hot_plug: (config.key?(:cpu_hot_plug) ? config[:cpu_hot_plug].to_s.downcase == 'true' : nil),
|
141
|
+
ram_hot_plug: (config.key?(:ram_hot_plug) ? config[:ram_hot_plug].to_s.downcase == 'true' : nil),
|
142
|
+
nic_hot_plug: (config.key?(:nic_hot_plug) ? config[:nic_hot_plug].to_s.downcase == 'true' : nil),
|
143
|
+
nic_hot_unplug: (config.key?(:nic_hot_unplug) ? config[:nic_hot_unplug].to_s.downcase == 'true' : nil),
|
144
|
+
disc_virtio_hot_plug: (config.key?(:disc_virtio_hot_plug) ? config[:disc_virtio_hot_plug].to_s.downcase == 'true' : nil),
|
145
|
+
disc_virtio_hot_unplug: (config.key?(:disc_virtio_hot_unplug) ? config[:disc_virtio_hot_unplug].to_s.downcase == 'true' : nil),
|
146
|
+
),
|
147
|
+
),
|
113
148
|
)
|
114
149
|
|
115
150
|
dot = ui.color('.', :magenta)
|
116
151
|
api_client.wait_for(300) { print dot; is_done? get_request_id headers }
|
117
152
|
|
118
|
-
|
119
|
-
|
120
|
-
puts "\n"
|
121
|
-
puts "#{ui.color('ID', :cyan)}: #{volume.id}"
|
122
|
-
puts "#{ui.color('Name', :cyan)}: #{volume.properties.name}"
|
123
|
-
puts "#{ui.color('Size', :cyan)}: #{volume.properties.size}"
|
124
|
-
puts "#{ui.color('Bus', :cyan)}: #{volume.properties.bus}"
|
125
|
-
puts "#{ui.color('Image', :cyan)}: #{volume.properties.image}"
|
126
|
-
puts "#{ui.color('Type', :cyan)}: #{volume.properties.type}"
|
127
|
-
puts "#{ui.color('Licence Type', :cyan)}: #{volume.properties.licence_type}"
|
128
|
-
puts "#{ui.color('Zone', :cyan)}: #{volume.properties.availability_zone}"
|
129
|
-
puts 'done'
|
153
|
+
print_volume(volume_api.datacenters_volumes_find_by_id(config[:datacenter_id], volume.id))
|
130
154
|
end
|
131
155
|
end
|
132
156
|
end
|
@@ -24,6 +24,7 @@ class Chef
|
|
24
24
|
|
25
25
|
def run
|
26
26
|
$stdout.sync = true
|
27
|
+
handle_extra_config
|
27
28
|
validate_required_params(@required_options, config)
|
28
29
|
|
29
30
|
volume_api = Ionoscloud::VolumeApi.new(api_client)
|
@@ -40,14 +41,7 @@ class Chef
|
|
40
41
|
next
|
41
42
|
end
|
42
43
|
|
43
|
-
|
44
|
-
msg_pair('Name', volume.properties.name)
|
45
|
-
msg_pair('Size', volume.properties.size)
|
46
|
-
msg_pair('Bus', volume.properties.bus)
|
47
|
-
msg_pair('Image', volume.properties.image)
|
48
|
-
msg_pair('Type', volume.properties.type)
|
49
|
-
msg_pair('Licence Type', volume.properties.licence_type)
|
50
|
-
msg_pair('Zone', volume.properties.availability_zone)
|
44
|
+
print_volume(volume)
|
51
45
|
|
52
46
|
begin
|
53
47
|
confirm('Do you really want to delete this volume')
|
@@ -31,6 +31,7 @@ class Chef
|
|
31
31
|
|
32
32
|
def run
|
33
33
|
$stdout.sync = true
|
34
|
+
handle_extra_config
|
34
35
|
validate_required_params(@required_options, config)
|
35
36
|
|
36
37
|
server_api = Ionoscloud::ServerApi.new(api_client)
|
@@ -48,14 +49,7 @@ class Chef
|
|
48
49
|
next
|
49
50
|
end
|
50
51
|
|
51
|
-
|
52
|
-
msg_pair('Name', volume.properties.name)
|
53
|
-
msg_pair('Size', volume.properties.size)
|
54
|
-
msg_pair('Bus', volume.properties.bus)
|
55
|
-
msg_pair('Image', volume.properties.image)
|
56
|
-
msg_pair('Type', volume.properties.type)
|
57
|
-
msg_pair('Licence Type', volume.properties.licence_type)
|
58
|
-
msg_pair('Zone', volume.properties.availability_zone)
|
52
|
+
print_volume(volume)
|
59
53
|
|
60
54
|
begin
|
61
55
|
confirm('Do you really want to detach this volume')
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudVolumeGet < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud volume get (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 :volume_id,
|
16
|
+
long: '--volume VOLUME_ID',
|
17
|
+
description: 'ID of the volume.'
|
18
|
+
|
19
|
+
attr_reader :description, :required_options
|
20
|
+
|
21
|
+
def initialize(args = [])
|
22
|
+
super(args)
|
23
|
+
@description =
|
24
|
+
'Retrieves the attributes of a given Volume.'
|
25
|
+
@required_options = [:datacenter_id, :volume_id, :ionoscloud_username, :ionoscloud_password]
|
26
|
+
end
|
27
|
+
|
28
|
+
def run
|
29
|
+
$stdout.sync = true
|
30
|
+
handle_extra_config
|
31
|
+
validate_required_params(@required_options, config)
|
32
|
+
print_volume(Ionoscloud::VolumeApi.new(api_client).datacenters_volumes_find_by_id(config[:datacenter_id], config[:volume_id]))
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -29,6 +29,7 @@ class Chef
|
|
29
29
|
|
30
30
|
def run
|
31
31
|
$stdout.sync = true
|
32
|
+
handle_extra_config
|
32
33
|
validate_required_params(@required_options, config)
|
33
34
|
|
34
35
|
volume_list = [
|
@@ -39,7 +40,7 @@ class Chef
|
|
39
40
|
ui.color('Image', :bold),
|
40
41
|
ui.color('Type', :bold),
|
41
42
|
ui.color('Zone', :bold),
|
42
|
-
ui.color('Device Number', :bold)
|
43
|
+
ui.color('Device Number', :bold),
|
43
44
|
]
|
44
45
|
|
45
46
|
opts = { depth: 1 }
|
@@ -0,0 +1,106 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudVolumeUpdate < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud volume update (options)'
|
9
|
+
|
10
|
+
option :datacenter_id,
|
11
|
+
short: '-D DATACENTER_ID',
|
12
|
+
long: '--datacenter-id DATACENTER_ID',
|
13
|
+
description: 'Name of the data center'
|
14
|
+
|
15
|
+
option :volume_id,
|
16
|
+
long: '--volume VOLUME_ID',
|
17
|
+
description: 'ID of the Volume.'
|
18
|
+
|
19
|
+
option :name,
|
20
|
+
short: '-n NAME',
|
21
|
+
long: '--name NAME',
|
22
|
+
description: 'Name of the volume'
|
23
|
+
|
24
|
+
option :size,
|
25
|
+
short: '-S SIZE',
|
26
|
+
long: '--size SIZE',
|
27
|
+
description: 'The size of the volume in GB'
|
28
|
+
|
29
|
+
option :bus,
|
30
|
+
short: '-b BUS',
|
31
|
+
long: '--bus BUS',
|
32
|
+
description: 'The bus type of the volume (VIRTIO or IDE)'
|
33
|
+
|
34
|
+
option :cpu_hot_plug,
|
35
|
+
long: '--cpu-hot-plug CPU_HOT_PLUG',
|
36
|
+
description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
37
|
+
|
38
|
+
option :ram_hot_plug,
|
39
|
+
long: '--ram-hot-plug RAM_HOT_PLUG',
|
40
|
+
description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
41
|
+
|
42
|
+
option :nic_hot_plug,
|
43
|
+
long: '--nic-hot-plug NIC_HOT_PLUG',
|
44
|
+
description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
45
|
+
|
46
|
+
option :nic_hot_unplug,
|
47
|
+
long: '--nic-hot-unplug NIC_HOT_UNPLUG',
|
48
|
+
description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
49
|
+
|
50
|
+
option :disc_virtio_hot_plug,
|
51
|
+
long: '--disc-virtio-hot_plug DISC_VIRTIO_HOT_PLUG',
|
52
|
+
description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
53
|
+
|
54
|
+
option :disc_virtio_hot_unplug,
|
55
|
+
long: '--disc-virtio-hot_unplug DISC_VIRTIO_HOT_UNPLUG',
|
56
|
+
description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
57
|
+
|
58
|
+
attr_reader :description, :required_options
|
59
|
+
|
60
|
+
def initialize(args = [])
|
61
|
+
super(args)
|
62
|
+
@description =
|
63
|
+
'Updates information about a Ionoscloud Volume.'
|
64
|
+
@required_options = [:datacenter_id, :volume_id, :ionoscloud_username, :ionoscloud_password]
|
65
|
+
@updatable_fields = [
|
66
|
+
:name, :size, :bus, :cpu_hot_plug, :ram_hot_plug, :nic_hot_plug, :nic_hot_unplug, :disc_virtio_hot_plug, :disc_virtio_hot_unplug,
|
67
|
+
]
|
68
|
+
end
|
69
|
+
|
70
|
+
def run
|
71
|
+
$stdout.sync = true
|
72
|
+
handle_extra_config
|
73
|
+
validate_required_params(@required_options, config)
|
74
|
+
|
75
|
+
volume = Ionoscloud::VolumeApi.new(api_client)
|
76
|
+
|
77
|
+
if @updatable_fields.map { |el| config[el] }.any?
|
78
|
+
print "#{ui.color('Updating Volume...', :magenta)}"
|
79
|
+
|
80
|
+
_, _, headers = volume.datacenters_volumes_patch_with_http_info(
|
81
|
+
config[:datacenter_id],
|
82
|
+
config[:volume_id],
|
83
|
+
Ionoscloud::VolumeProperties.new(
|
84
|
+
name: config[:name],
|
85
|
+
size: config[:size],
|
86
|
+
bus: config[:bus],
|
87
|
+
cpu_hot_plug: (config.key?(:cpu_hot_plug) ? config[:cpu_hot_plug].to_s.downcase == 'true' : nil),
|
88
|
+
ram_hot_plug: (config.key?(:ram_hot_plug) ? config[:ram_hot_plug].to_s.downcase == 'true' : nil),
|
89
|
+
nic_hot_plug: (config.key?(:nic_hot_plug) ? config[:nic_hot_plug].to_s.downcase == 'true' : nil),
|
90
|
+
nic_hot_unplug: (config.key?(:nic_hot_unplug) ? config[:nic_hot_unplug].to_s.downcase == 'true' : nil),
|
91
|
+
disc_virtio_hot_plug: (config.key?(:disc_virtio_hot_plug) ? config[:disc_virtio_hot_plug].to_s.downcase == 'true' : nil),
|
92
|
+
disc_virtio_hot_unplug: (config.key?(:disc_virtio_hot_unplug) ? config[:disc_virtio_hot_unplug].to_s.downcase == 'true' : nil),
|
93
|
+
),
|
94
|
+
)
|
95
|
+
|
96
|
+
dot = ui.color('.', :magenta)
|
97
|
+
api_client.wait_for { print dot; is_done? get_request_id headers }
|
98
|
+
else
|
99
|
+
ui.warn("Nothing to update, please set one of the attributes #{@updatable_fields}.")
|
100
|
+
end
|
101
|
+
|
102
|
+
print_volume(volume.datacenters_volumes_find_by_id(config[:datacenter_id], config[:volume_id]))
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
sonar.projectKey=knife-plugin
|
2
|
+
sonar.organization=ionos-cloud
|
3
|
+
|
4
|
+
# This is the name and version displayed in the SonarCloud UI.
|
5
|
+
#sonar.projectName=knife-plugin
|
6
|
+
#sonar.projectVersion=1.0
|
7
|
+
|
8
|
+
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
|
9
|
+
#sonar.sources=.
|
10
|
+
|
11
|
+
# Encoding of the source code. Default is default system encoding
|
12
|
+
#sonar.sourceEncoding=UTF-8
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ionoscloud_backupunit_get'
|
3
|
+
|
4
|
+
Chef::Knife::IonoscloudBackupunitGet.load_deps
|
5
|
+
|
6
|
+
describe Chef::Knife::IonoscloudBackupunitGet do
|
7
|
+
before :each do
|
8
|
+
subject { Chef::Knife::IonoscloudBackupunitGet.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 BackupUnitApi.backupunits_find_by_id' do
|
16
|
+
backupunit = backupunit_mock
|
17
|
+
subject_config = {
|
18
|
+
ionoscloud_username: 'email',
|
19
|
+
ionoscloud_password: 'password',
|
20
|
+
backupunit_id: backupunit.id,
|
21
|
+
yes: true,
|
22
|
+
}
|
23
|
+
|
24
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
25
|
+
|
26
|
+
expect(subject).to receive(:puts).with("ID: #{backupunit.id}")
|
27
|
+
expect(subject).to receive(:puts).with("Name: #{backupunit.properties.name}")
|
28
|
+
expect(subject).to receive(:puts).with("Email: #{backupunit.properties.email}")
|
29
|
+
|
30
|
+
expect(subject.api_client).not_to receive(:wait_for)
|
31
|
+
mock_call_api(
|
32
|
+
subject,
|
33
|
+
[
|
34
|
+
{
|
35
|
+
method: 'GET',
|
36
|
+
path: "/backupunits/#{backupunit.id}",
|
37
|
+
operation: :'BackupUnitApi.backupunits_find_by_id',
|
38
|
+
return_type: 'BackupUnit',
|
39
|
+
result: backupunit,
|
40
|
+
},
|
41
|
+
],
|
42
|
+
)
|
43
|
+
|
44
|
+
expect { subject.run }.not_to raise_error(Exception)
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'should not make any call if any required option is missing' do
|
48
|
+
required_options = subject.instance_variable_get(:@required_options)
|
49
|
+
|
50
|
+
arrays_without_one_element(required_options).each do |test_case|
|
51
|
+
|
52
|
+
test_case[:array].each { |value| subject.config[value] = 'test' }
|
53
|
+
|
54
|
+
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
55
|
+
expect(subject.api_client).not_to receive(:call_api)
|
56
|
+
|
57
|
+
expect { subject.run }.to raise_error(SystemExit) do |error|
|
58
|
+
expect(error.status).to eq(1)
|
59
|
+
end
|
60
|
+
|
61
|
+
required_options.each { |value| subject.config[value] = nil }
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ionoscloud_backupunit_update'
|
3
|
+
|
4
|
+
Chef::Knife::IonoscloudBackupunitUpdate.load_deps
|
5
|
+
|
6
|
+
describe Chef::Knife::IonoscloudBackupunitUpdate do
|
7
|
+
before :each do
|
8
|
+
subject { Chef::Knife::IonoscloudBackupunitUpdate.new }
|
9
|
+
|
10
|
+
allow(subject).to receive(:puts)
|
11
|
+
allow(subject).to receive(:print)
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#run' do
|
15
|
+
it 'should call BackupUnitApi.backupunits_patch' do
|
16
|
+
backupunit = backupunit_mock
|
17
|
+
subject_config = {
|
18
|
+
ionoscloud_username: 'email',
|
19
|
+
ionoscloud_password: 'password',
|
20
|
+
backupunit_id: backupunit.id,
|
21
|
+
email: 'edited' + backupunit.properties.email,
|
22
|
+
password: 'password_edited',
|
23
|
+
yes: true,
|
24
|
+
}
|
25
|
+
|
26
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
27
|
+
|
28
|
+
|
29
|
+
expect(subject).to receive(:puts).with("ID: #{backupunit.id}")
|
30
|
+
expect(subject).to receive(:puts).with("Name: #{backupunit.properties.name}")
|
31
|
+
expect(subject).to receive(:puts).with("Email: #{subject_config[:email]}")
|
32
|
+
|
33
|
+
backupunit.properties.email = subject_config[:email]
|
34
|
+
|
35
|
+
mock_wait_for(subject)
|
36
|
+
mock_call_api(
|
37
|
+
subject,
|
38
|
+
[
|
39
|
+
{
|
40
|
+
method: 'PATCH',
|
41
|
+
path: "/backupunits/#{backupunit.id}",
|
42
|
+
operation: :'BackupUnitApi.backupunits_patch',
|
43
|
+
return_type: 'BackupUnit',
|
44
|
+
body: { email: subject_config[:email], password: subject_config[:password] },
|
45
|
+
result: backupunit,
|
46
|
+
},
|
47
|
+
{
|
48
|
+
method: 'GET',
|
49
|
+
path: "/backupunits/#{backupunit.id}",
|
50
|
+
operation: :'BackupUnitApi.backupunits_find_by_id',
|
51
|
+
return_type: 'BackupUnit',
|
52
|
+
result: backupunit,
|
53
|
+
},
|
54
|
+
],
|
55
|
+
)
|
56
|
+
|
57
|
+
expect { subject.run }.not_to raise_error(Exception)
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'should not make any call if any required option is missing' do
|
61
|
+
required_options = subject.instance_variable_get(:@required_options)
|
62
|
+
|
63
|
+
arrays_without_one_element(required_options).each do |test_case|
|
64
|
+
|
65
|
+
test_case[:array].each { |value| subject.config[value] = 'test' }
|
66
|
+
|
67
|
+
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
68
|
+
expect(subject.api_client).not_to receive(:call_api)
|
69
|
+
|
70
|
+
expect { subject.run }.to raise_error(SystemExit) do |error|
|
71
|
+
expect(error.status).to eq(1)
|
72
|
+
end
|
73
|
+
|
74
|
+
required_options.each { |value| subject.config[value] = nil }
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -29,6 +29,9 @@ describe Chef::Knife::IonoscloudDatacenterCreate do
|
|
29
29
|
expect(subject).to receive(:puts).with("Name: #{datacenter.properties.name}")
|
30
30
|
expect(subject).to receive(:puts).with("Description: #{datacenter.properties.description}")
|
31
31
|
expect(subject).to receive(:puts).with("Location: #{datacenter.properties.location}")
|
32
|
+
expect(subject).to receive(:puts).with("Version: #{datacenter.properties.version}")
|
33
|
+
expect(subject).to receive(:puts).with("Features: #{datacenter.properties.features}")
|
34
|
+
expect(subject).to receive(:puts).with("Sec Auth Protection: #{datacenter.properties.sec_auth_protection}")
|
32
35
|
|
33
36
|
expected_body = datacenter.properties.to_hash
|
34
37
|
expected_body.delete(:version)
|
@@ -45,6 +48,13 @@ describe Chef::Knife::IonoscloudDatacenterCreate do
|
|
45
48
|
body: { properties: expected_body },
|
46
49
|
result: datacenter,
|
47
50
|
},
|
51
|
+
{
|
52
|
+
method: 'GET',
|
53
|
+
path: "/datacenters/#{datacenter.id}",
|
54
|
+
operation: :'DataCenterApi.datacenters_find_by_id',
|
55
|
+
return_type: 'Datacenter',
|
56
|
+
result: datacenter,
|
57
|
+
},
|
48
58
|
],
|
49
59
|
)
|
50
60
|
|
@@ -27,6 +27,9 @@ describe Chef::Knife::IonoscloudDatacenterDelete do
|
|
27
27
|
expect(subject).to receive(:puts).with("Name: #{datacenter.properties.name}")
|
28
28
|
expect(subject).to receive(:puts).with("Description: #{datacenter.properties.description}")
|
29
29
|
expect(subject).to receive(:puts).with("Location: #{datacenter.properties.location}")
|
30
|
+
expect(subject).to receive(:puts).with("Version: #{datacenter.properties.version}")
|
31
|
+
expect(subject).to receive(:puts).with("Features: #{datacenter.properties.features}")
|
32
|
+
expect(subject).to receive(:puts).with("Sec Auth Protection: #{datacenter.properties.sec_auth_protection}")
|
30
33
|
expect(subject.ui).to receive(:warn).with("Deleted Data center #{datacenter.id}. Request ID: ")
|
31
34
|
|
32
35
|
expect(subject.api_client).not_to receive(:wait_for)
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ionoscloud_datacenter_get'
|
3
|
+
|
4
|
+
Chef::Knife::IonoscloudDatacenterGet.load_deps
|
5
|
+
|
6
|
+
describe Chef::Knife::IonoscloudDatacenterGet do
|
7
|
+
before :each do
|
8
|
+
subject { Chef::Knife::IonoscloudDatacenterGet.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 DataCenterApi.datacenters_find_by_id' do
|
16
|
+
datacenter = datacenter_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
|
+
|
26
|
+
expect(subject).to receive(:puts).with("ID: #{datacenter.id}")
|
27
|
+
expect(subject).to receive(:puts).with("Name: #{datacenter.properties.name}")
|
28
|
+
expect(subject).to receive(:puts).with("Description: #{datacenter.properties.description}")
|
29
|
+
expect(subject).to receive(:puts).with("Location: #{datacenter.properties.location}")
|
30
|
+
expect(subject).to receive(:puts).with("Version: #{datacenter.properties.version}")
|
31
|
+
expect(subject).to receive(:puts).with("Features: #{datacenter.properties.features}")
|
32
|
+
expect(subject).to receive(:puts).with("Sec Auth Protection: #{datacenter.properties.sec_auth_protection}")
|
33
|
+
|
34
|
+
expect(subject.api_client).not_to receive(:wait_for)
|
35
|
+
mock_call_api(
|
36
|
+
subject,
|
37
|
+
[
|
38
|
+
{
|
39
|
+
method: 'GET',
|
40
|
+
path: "/datacenters/#{datacenter.id}",
|
41
|
+
operation: :'DataCenterApi.datacenters_find_by_id',
|
42
|
+
return_type: 'Datacenter',
|
43
|
+
result: datacenter,
|
44
|
+
},
|
45
|
+
],
|
46
|
+
)
|
47
|
+
|
48
|
+
expect { subject.run }.not_to raise_error(Exception)
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'should not make any call if any required option is missing' do
|
52
|
+
required_options = subject.instance_variable_get(:@required_options)
|
53
|
+
|
54
|
+
arrays_without_one_element(required_options).each do |test_case|
|
55
|
+
|
56
|
+
test_case[:array].each { |value| subject.config[value] = 'test' }
|
57
|
+
|
58
|
+
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
59
|
+
expect(subject.api_client).not_to receive(:call_api)
|
60
|
+
|
61
|
+
expect { subject.run }.to raise_error(SystemExit) do |error|
|
62
|
+
expect(error.status).to eq(1)
|
63
|
+
end
|
64
|
+
|
65
|
+
required_options.each { |value| subject.config[value] = nil }
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -27,6 +27,7 @@ describe Chef::Knife::IonoscloudDatacenterList do
|
|
27
27
|
subject.ui.color('Description', :bold),
|
28
28
|
subject.ui.color('Location', :bold),
|
29
29
|
subject.ui.color('Version', :bold),
|
30
|
+
subject.ui.color('Sec Auth Protection', :bold),
|
30
31
|
]
|
31
32
|
|
32
33
|
datacenters.items.each do |datacenter|
|
@@ -35,9 +36,10 @@ describe Chef::Knife::IonoscloudDatacenterList do
|
|
35
36
|
datacenter_list << datacenter.properties.description
|
36
37
|
datacenter_list << datacenter.properties.location
|
37
38
|
datacenter_list << datacenter.properties.version.to_s
|
39
|
+
datacenter_list << datacenter.properties.sec_auth_protection.to_s
|
38
40
|
end
|
39
41
|
|
40
|
-
expect(subject.ui).to receive(:list).with(datacenter_list, :uneven_columns_across,
|
42
|
+
expect(subject.ui).to receive(:list).with(datacenter_list, :uneven_columns_across, 6)
|
41
43
|
|
42
44
|
mock_call_api(
|
43
45
|
subject,
|