knife-ionoscloud 5.1.0 → 6.0.0.alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/knife-ionoscloud.gemspec +1 -1
- data/lib/chef/knife/ionoscloud_backupunit_create.rb +1 -1
- data/lib/chef/knife/ionoscloud_backupunit_delete.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_base.rb +1 -1
- data/lib/chef/knife/ionoscloud_composite_server_create.rb +25 -23
- data/lib/chef/knife/ionoscloud_contract_list.rb +32 -23
- data/lib/chef/knife/ionoscloud_cube_server_create.rb +215 -0
- data/lib/chef/knife/ionoscloud_datacenter_create.rb +1 -1
- data/lib/chef/knife/ionoscloud_datacenter_delete.rb +1 -1
- data/lib/chef/knife/ionoscloud_datacenter_list.rb +4 -2
- data/lib/chef/knife/ionoscloud_firewall_create.rb +11 -4
- data/lib/chef/knife/ionoscloud_firewall_delete.rb +4 -3
- data/lib/chef/knife/ionoscloud_firewall_list.rb +5 -3
- data/lib/chef/knife/ionoscloud_flowlog_create.rb +121 -0
- data/lib/chef/knife/ionoscloud_flowlog_delete.rb +106 -0
- data/lib/chef/knife/ionoscloud_flowlog_list.rb +100 -0
- data/lib/chef/knife/ionoscloud_group_create.rb +35 -14
- data/lib/chef/knife/ionoscloud_group_delete.rb +7 -0
- data/lib/chef/knife/ionoscloud_group_get.rb +6 -0
- data/lib/chef/knife/ionoscloud_group_list.rb +19 -7
- data/lib/chef/knife/ionoscloud_image_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_ipfailover_add.rb +1 -1
- data/lib/chef/knife/ionoscloud_ipfailover_remove.rb +1 -1
- data/lib/chef/knife/ionoscloud_k8s_delete.rb +5 -2
- 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 -1
- data/lib/chef/knife/ionoscloud_lan_delete.rb +1 -1
- data/lib/chef/knife/ionoscloud_lan_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_loadbalancer_create.rb +1 -1
- data/lib/chef/knife/ionoscloud_loadbalancer_delete.rb +1 -1
- data/lib/chef/knife/ionoscloud_loadbalancer_get.rb +1 -1
- data/lib/chef/knife/ionoscloud_loadbalancer_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_loadbalancer_nic_add.rb +1 -1
- data/lib/chef/knife/ionoscloud_loadbalancer_nic_remove.rb +1 -1
- data/lib/chef/knife/ionoscloud_location_list.rb +5 -3
- data/lib/chef/knife/ionoscloud_natgateway_create.rb +71 -0
- data/lib/chef/knife/ionoscloud_natgateway_delete.rb +69 -0
- data/lib/chef/knife/ionoscloud_natgateway_lan_add.rb +82 -0
- data/lib/chef/knife/ionoscloud_natgateway_lan_remove.rb +58 -0
- data/lib/chef/knife/ionoscloud_natgateway_list.rb +49 -0
- data/lib/chef/knife/ionoscloud_natgateway_rule_add.rb +124 -0
- data/lib/chef/knife/ionoscloud_natgateway_rule_list.rb +63 -0
- data/lib/chef/knife/ionoscloud_natgateway_rule_remove.rb +72 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_create.rb +95 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_delete.rb +81 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_list.rb +56 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_add.rb +150 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_list.rb +63 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_remove.rb +78 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_target_add.rb +141 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_target_list.rb +68 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_target_remove.rb +105 -0
- data/lib/chef/knife/ionoscloud_nic_create.rb +14 -9
- data/lib/chef/knife/ionoscloud_nic_delete.rb +4 -2
- data/lib/chef/knife/ionoscloud_nic_list.rb +9 -5
- data/lib/chef/knife/ionoscloud_node_list.rb +0 -1
- data/lib/chef/knife/ionoscloud_nodepool_create.rb +42 -16
- data/lib/chef/knife/ionoscloud_nodepool_delete.rb +25 -0
- data/lib/chef/knife/ionoscloud_nodepool_lan_add.rb +130 -0
- data/lib/chef/knife/ionoscloud_nodepool_lan_remove.rb +96 -0
- data/lib/chef/knife/ionoscloud_nodepool_list.rb +3 -1
- data/lib/chef/knife/ionoscloud_pcc_create.rb +2 -2
- data/lib/chef/knife/ionoscloud_pcc_delete.rb +1 -1
- data/lib/chef/knife/ionoscloud_pcc_list.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_list.rb +2 -2
- data/lib/chef/knife/ionoscloud_server_console.rb +42 -0
- data/lib/chef/knife/ionoscloud_server_create.rb +8 -8
- data/lib/chef/knife/ionoscloud_server_delete.rb +1 -1
- 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 +43 -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 +44 -0
- data/lib/chef/knife/ionoscloud_server_token.rb +42 -0
- data/lib/chef/knife/ionoscloud_server_upgrade.rb +44 -0
- 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_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_snapshot_restore.rb +2 -2
- data/lib/chef/knife/ionoscloud_template_list.rb +46 -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 +33 -35
- data/lib/chef/knife/ionoscloud_volume_delete.rb +1 -1
- data/lib/chef/knife/ionoscloud_volume_detach.rb +1 -1
- data/lib/chef/knife/ionoscloud_volume_list.rb +2 -2
- 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_list_spec.rb +1 -1
- data/spec/chef/knife/ionoscloud_backupunit_ssourl_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 -2
- data/spec/chef/knife/ionoscloud_datacenter_delete_spec.rb +5 -5
- data/spec/chef/knife/ionoscloud_datacenter_list_spec.rb +5 -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_list_spec.rb +5 -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_list_spec.rb +264 -0
- data/spec/chef/knife/ionoscloud_group_create_spec.rb +6 -0
- data/spec/chef/knife/ionoscloud_group_delete_spec.rb +6 -0
- data/spec/chef/knife/ionoscloud_group_get_spec.rb +6 -0
- data/spec/chef/knife/ionoscloud_group_list_spec.rb +26 -8
- data/spec/chef/knife/ionoscloud_image_list_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_ipfailover_add_spec.rb +3 -3
- data/spec/chef/knife/ionoscloud_ipfailover_remove_spec.rb +4 -4
- data/spec/chef/knife/ionoscloud_k8s_delete_spec.rb +5 -2
- 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_list_spec.rb +2 -2
- 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_location_list_spec.rb +5 -3
- data/spec/chef/knife/ionoscloud_natgateway_create_spec.rb +77 -0
- data/spec/chef/knife/ionoscloud_natgateway_delete_spec.rb +118 -0
- data/spec/chef/knife/ionoscloud_natgateway_lan_add_spec.rb +143 -0
- data/spec/chef/knife/ionoscloud_natgateway_lan_remove_spec.rb +194 -0
- data/spec/chef/knife/ionoscloud_natgateway_list_spec.rb +79 -0
- data/spec/chef/knife/ionoscloud_natgateway_rule_add_spec.rb +98 -0
- data/spec/chef/knife/ionoscloud_natgateway_rule_list_spec.rb +92 -0
- data/spec/chef/knife/ionoscloud_natgateway_rule_remove_spec.rb +77 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_create_spec.rb +80 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_delete_spec.rb +119 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_list_spec.rb +88 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_add_spec.rb +104 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_list_spec.rb +89 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_remove_spec.rb +124 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_target_add_spec.rb +109 -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 +263 -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_list_spec.rb +12 -6
- data/spec/chef/knife/ionoscloud_nodepool_create_spec.rb +15 -1
- data/spec/chef/knife/ionoscloud_nodepool_lan_add_spec.rb +226 -0
- data/spec/chef/knife/ionoscloud_nodepool_lan_remove.rb +199 -0
- data/spec/chef/knife/ionoscloud_nodepool_list_spec.rb +3 -1
- data/spec/chef/knife/ionoscloud_pcc_create_spec.rb +6 -6
- data/spec/chef/knife/ionoscloud_pcc_delete_spec.rb +5 -5
- data/spec/chef/knife/ionoscloud_pcc_list_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_request_list_spec.rb +16 -16
- data/spec/chef/knife/ionoscloud_request_status_spec.rb +3 -3
- data/spec/chef/knife/ionoscloud_s3key_create_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_s3key_delete_spec.rb +5 -5
- data/spec/chef/knife/ionoscloud_s3key_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 +3 -3
- data/spec/chef/knife/ionoscloud_server_delete_spec.rb +5 -5
- 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_upgrade_spec.rb +96 -0
- data/spec/chef/knife/ionoscloud_snapshot_create_spec.rb +3 -3
- data/spec/chef/knife/ionoscloud_snapshot_delete_spec.rb +5 -5
- data/spec/chef/knife/ionoscloud_snapshot_list_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_snapshot_restore_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 +6 -58
- data/spec/chef/knife/ionoscloud_volume_delete_spec.rb +5 -5
- data/spec/chef/knife/ionoscloud_volume_detach_spec.rb +5 -5
- data/spec/chef/knife/ionoscloud_volume_list_spec.rb +4 -4
- data/spec/spec_helper.rb +223 -29
- metadata +93 -6
|
@@ -28,7 +28,7 @@ class Chef
|
|
|
28
28
|
ui.color('Size', :bold)
|
|
29
29
|
]
|
|
30
30
|
|
|
31
|
-
snapshot_api = Ionoscloud::
|
|
31
|
+
snapshot_api = Ionoscloud::SnapshotsApi.new(api_client)
|
|
32
32
|
|
|
33
33
|
snapshot_api.snapshots_get({ depth: 1 }).items.each do |snapshot|
|
|
34
34
|
snapshot_list << snapshot.id
|
|
@@ -38,7 +38,7 @@ class Chef
|
|
|
38
38
|
|
|
39
39
|
print "#{ui.color('Restoring Snapshot...', :magenta)}"
|
|
40
40
|
|
|
41
|
-
volume_api = Ionoscloud::
|
|
41
|
+
volume_api = Ionoscloud::VolumesApi.new(api_client)
|
|
42
42
|
|
|
43
43
|
_, _, headers = volume_api.datacenters_volumes_restore_snapshot_post_with_http_info(
|
|
44
44
|
config[:datacenter_id],
|
|
@@ -49,7 +49,7 @@ class Chef
|
|
|
49
49
|
dot = ui.color('.', :magenta)
|
|
50
50
|
api_client.wait_for { print dot; is_done? get_request_id headers }
|
|
51
51
|
|
|
52
|
-
volume_api = Ionoscloud::
|
|
52
|
+
volume_api = Ionoscloud::VolumesApi.new(api_client)
|
|
53
53
|
|
|
54
54
|
volume = volume_api.datacenters_volumes_find_by_id(config[:datacenter_id], config[:volume_id])
|
|
55
55
|
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
require_relative 'ionoscloud_base'
|
|
2
|
+
|
|
3
|
+
class Chef
|
|
4
|
+
class Knife
|
|
5
|
+
class IonoscloudTemplateList < Knife
|
|
6
|
+
include Knife::IonoscloudBase
|
|
7
|
+
|
|
8
|
+
banner 'knife ionoscloud template list'
|
|
9
|
+
|
|
10
|
+
attr_reader :description, :required_options
|
|
11
|
+
|
|
12
|
+
def initialize(args = [])
|
|
13
|
+
super(args)
|
|
14
|
+
@description =
|
|
15
|
+
'Retrieve a list of available templates. Templates can be used on specific server types only (CUBE at the moment)'
|
|
16
|
+
@required_options = [:ionoscloud_username, :ionoscloud_password]
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def run
|
|
20
|
+
$stdout.sync = true
|
|
21
|
+
validate_required_params(@required_options, config)
|
|
22
|
+
|
|
23
|
+
template_list = [
|
|
24
|
+
ui.color('ID', :bold),
|
|
25
|
+
ui.color('Name', :bold),
|
|
26
|
+
ui.color('Cores', :bold),
|
|
27
|
+
ui.color('RAM', :bold),
|
|
28
|
+
ui.color('Storage Size', :bold),
|
|
29
|
+
]
|
|
30
|
+
templates_api = Ionoscloud::TemplatesApi.new(api_client)
|
|
31
|
+
|
|
32
|
+
templates_api.templates_get({ depth: 1 }).items.sort do |a, b|
|
|
33
|
+
a.properties.cores != b.properties.cores ? a.properties.cores <=> b.properties.cores : a.properties.ram <=> b.properties.ram
|
|
34
|
+
end.each do |template|
|
|
35
|
+
template_list << template.id
|
|
36
|
+
template_list << template.properties.name
|
|
37
|
+
template_list << Integer(template.properties.cores)
|
|
38
|
+
template_list << Integer(template.properties.ram)
|
|
39
|
+
template_list << Integer(template.properties.storage_size)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
puts ui.list(template_list, :uneven_columns_across, 5)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -26,7 +26,7 @@ class Chef
|
|
|
26
26
|
validate_required_params(@required_options, config)
|
|
27
27
|
|
|
28
28
|
begin
|
|
29
|
-
puts Ionoscloud::
|
|
29
|
+
puts Ionoscloud::UserS3KeysApi.new(api_client).um_users_s3ssourl_get(config[:user_id]).sso_url
|
|
30
30
|
rescue Ionoscloud::ApiError => err
|
|
31
31
|
raise err unless err.code == 404
|
|
32
32
|
ui.error("User ID #{config[:user_id]} not found.")
|
|
@@ -32,10 +32,6 @@ class Chef
|
|
|
32
32
|
long: '--image ID',
|
|
33
33
|
description: 'The image or snapshot ID'
|
|
34
34
|
|
|
35
|
-
option :image_alias,
|
|
36
|
-
long: '--image-alias IMAGE_ALIAS',
|
|
37
|
-
description: '(required) The image alias'
|
|
38
|
-
|
|
39
35
|
option :image_password,
|
|
40
36
|
short: '-P PASSWORD',
|
|
41
37
|
long: '--image-password PASSWORD',
|
|
@@ -44,7 +40,7 @@ class Chef
|
|
|
44
40
|
option :type,
|
|
45
41
|
short: '-t TYPE',
|
|
46
42
|
long: '--type TYPE',
|
|
47
|
-
description: 'The disk type (HDD
|
|
43
|
+
description: 'The disk type (HDD, SSD, SSD Standard, SSD Premium, DAS)'
|
|
48
44
|
|
|
49
45
|
option :licence_type,
|
|
50
46
|
short: '-l LICENCE',
|
|
@@ -59,8 +55,21 @@ class Chef
|
|
|
59
55
|
option :availability_zone,
|
|
60
56
|
short: '-Z AVAILABILITY_ZONE',
|
|
61
57
|
long: '--availability-zone AVAILABILITY_ZONE',
|
|
62
|
-
description: 'The volume availability zone of the server'
|
|
63
|
-
|
|
58
|
+
description: 'The volume availability zone of the server'
|
|
59
|
+
|
|
60
|
+
option :backupunit_id,
|
|
61
|
+
short: '-B BACKUPUNIT_ID',
|
|
62
|
+
long: '--backupunit BACKUPUNIT_ID',
|
|
63
|
+
description: 'The uuid of the Backup Unit that user has access to. The property is immutable and is only allowed '\
|
|
64
|
+
'to be set on a new volume creation. It is mandatory to provide either \'public image\' or \'imageAlias\' in '\
|
|
65
|
+
'conjunction with this property.'
|
|
66
|
+
|
|
67
|
+
option :user_data,
|
|
68
|
+
short: '-u USER_DATA',
|
|
69
|
+
long: '--user-data USER_DATA',
|
|
70
|
+
description: 'The cloud-init configuration for the volume as base64 encoded string. The property is '\
|
|
71
|
+
'immutable and is only allowed to be set on a new volume creation. It is mandatory to provide either \'public image\' '\
|
|
72
|
+
'or \'imageAlias\' that has cloud-init compatibility in conjunction with this property.'
|
|
64
73
|
|
|
65
74
|
attr_reader :description, :required_options
|
|
66
75
|
|
|
@@ -76,40 +85,29 @@ class Chef
|
|
|
76
85
|
$stdout.sync = true
|
|
77
86
|
validate_required_params(@required_options, config)
|
|
78
87
|
|
|
79
|
-
|
|
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
|
|
88
|
+
config[:ssh_keys] = config[:ssh_keys].split(',') if config[:ssh_keys]
|
|
92
89
|
|
|
93
90
|
print "#{ui.color('Creating volume...', :magenta)}"
|
|
94
91
|
|
|
95
|
-
volume_api = Ionoscloud::
|
|
92
|
+
volume_api = Ionoscloud::VolumesApi.new(api_client)
|
|
93
|
+
|
|
94
|
+
volume_properties = {
|
|
95
|
+
name: config[:name],
|
|
96
|
+
size: config[:size],
|
|
97
|
+
bus: config[:bus] || 'VIRTIO',
|
|
98
|
+
type: config[:type],
|
|
99
|
+
licence_type: config[:licence_type],
|
|
100
|
+
image: config[:image],
|
|
101
|
+
ssh_keys: config[:ssh_keys],
|
|
102
|
+
image_password: config[:image_password],
|
|
103
|
+
availability_zone: config[:availability_zone],
|
|
104
|
+
backupunit_id: config[:backupunit_id],
|
|
105
|
+
user_data: config[:user_data],
|
|
106
|
+
}.compact
|
|
96
107
|
|
|
97
108
|
volume, _, headers = volume_api.datacenters_volumes_post_with_http_info(
|
|
98
109
|
config[:datacenter_id],
|
|
99
|
-
|
|
100
|
-
properties: {
|
|
101
|
-
name: config[:name],
|
|
102
|
-
size: config[:size],
|
|
103
|
-
bus: config[:bus] || 'VIRTIO',
|
|
104
|
-
type: config[:type],
|
|
105
|
-
licenceType: config[:licence_type],
|
|
106
|
-
image: config[:image],
|
|
107
|
-
imageAlias: config[:image_alias],
|
|
108
|
-
sshKeys: config[:sshKeys],
|
|
109
|
-
imagePassword: config[:image_password],
|
|
110
|
-
availabilityZone: config[:availability_zone],
|
|
111
|
-
}.compact
|
|
112
|
-
},
|
|
110
|
+
Ionoscloud::Volume.new(properties: Ionoscloud::VolumeProperties.new(**volume_properties)),
|
|
113
111
|
)
|
|
114
112
|
|
|
115
113
|
dot = ui.color('.', :magenta)
|
|
@@ -45,10 +45,10 @@ class Chef
|
|
|
45
45
|
opts = { depth: 1 }
|
|
46
46
|
|
|
47
47
|
if config[:server_id]
|
|
48
|
-
server_api = Ionoscloud::
|
|
48
|
+
server_api = Ionoscloud::ServersApi.new(api_client)
|
|
49
49
|
volumes = server_api.datacenters_servers_volumes_get(config[:datacenter_id], config[:server_id], opts)
|
|
50
50
|
else
|
|
51
|
-
volume_api = Ionoscloud::
|
|
51
|
+
volume_api = Ionoscloud::VolumesApi.new(api_client)
|
|
52
52
|
volumes = volume_api.datacenters_volumes_get(config[:datacenter_id], opts)
|
|
53
53
|
end
|
|
54
54
|
|
|
@@ -12,7 +12,7 @@ describe Chef::Knife::IonoscloudBackupunitCreate do
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
describe '#run' do
|
|
15
|
-
it 'should call
|
|
15
|
+
it 'should call BackupUnitsApi.backupunits_post with the expected arguments and output based on what it receives' do
|
|
16
16
|
backupunit = backupunit_mock
|
|
17
17
|
subject_config = {
|
|
18
18
|
ionoscloud_username: 'email',
|
|
@@ -33,7 +33,7 @@ describe Chef::Knife::IonoscloudBackupunitCreate do
|
|
|
33
33
|
{
|
|
34
34
|
method: 'POST',
|
|
35
35
|
path: '/backupunits',
|
|
36
|
-
operation: :'
|
|
36
|
+
operation: :'BackupUnitsApi.backupunits_post',
|
|
37
37
|
return_type: 'BackupUnit',
|
|
38
38
|
body: { properties: backupunit.properties.to_hash },
|
|
39
39
|
result: backupunit,
|
|
@@ -12,7 +12,7 @@ describe Chef::Knife::IonoscloudBackupunitDelete do
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
describe '#run' do
|
|
15
|
-
it 'should call
|
|
15
|
+
it 'should call BackupUnitsApi.backupunits_delete when the ID is valid' do
|
|
16
16
|
backupunit = backupunit_mock
|
|
17
17
|
subject_config = {
|
|
18
18
|
ionoscloud_username: 'email',
|
|
@@ -36,14 +36,14 @@ describe Chef::Knife::IonoscloudBackupunitDelete do
|
|
|
36
36
|
{
|
|
37
37
|
method: 'GET',
|
|
38
38
|
path: "/backupunits/#{backupunit.id}",
|
|
39
|
-
operation: :'
|
|
39
|
+
operation: :'BackupUnitsApi.backupunits_find_by_id',
|
|
40
40
|
return_type: 'BackupUnit',
|
|
41
41
|
result: backupunit,
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
method: 'DELETE',
|
|
45
45
|
path: "/backupunits/#{backupunit.id}",
|
|
46
|
-
operation: :'
|
|
46
|
+
operation: :'BackupUnitsApi.backupunits_delete',
|
|
47
47
|
},
|
|
48
48
|
],
|
|
49
49
|
)
|
|
@@ -51,7 +51,7 @@ describe Chef::Knife::IonoscloudBackupunitDelete do
|
|
|
51
51
|
expect { subject.run }.not_to raise_error(Exception)
|
|
52
52
|
end
|
|
53
53
|
|
|
54
|
-
it 'should not call
|
|
54
|
+
it 'should not call BackupUnitsApi.backupunits_delete when the ID is not valid' do
|
|
55
55
|
backup_unit = 'invalid_id'
|
|
56
56
|
subject_config = {
|
|
57
57
|
ionoscloud_username: 'email',
|
|
@@ -70,7 +70,7 @@ describe Chef::Knife::IonoscloudBackupunitDelete do
|
|
|
70
70
|
{
|
|
71
71
|
method: 'GET',
|
|
72
72
|
path: "/backupunits/#{backup_unit}",
|
|
73
|
-
operation: :'
|
|
73
|
+
operation: :'BackupUnitsApi.backupunits_find_by_id',
|
|
74
74
|
return_type: 'BackupUnit',
|
|
75
75
|
exception: Ionoscloud::ApiError.new(code: 404),
|
|
76
76
|
},
|
|
@@ -7,7 +7,7 @@ describe Chef::Knife::IonoscloudBackupunitSsourl do
|
|
|
7
7
|
subject { Chef::Knife::IonoscloudBackupunitSsourl.new }
|
|
8
8
|
|
|
9
9
|
describe '#run' do
|
|
10
|
-
it 'should call
|
|
10
|
+
it 'should call BackupUnitsApi.backupunits_ssourl_get and output the received url when the user ID is valid' do
|
|
11
11
|
backupunit = backupunit_mock
|
|
12
12
|
backupunit_sso = backupunit_sso_mock
|
|
13
13
|
subject_config = {
|
|
@@ -27,7 +27,7 @@ describe Chef::Knife::IonoscloudBackupunitSsourl do
|
|
|
27
27
|
{
|
|
28
28
|
method: 'GET',
|
|
29
29
|
path: "/backupunits/#{backupunit.id}/ssourl",
|
|
30
|
-
operation: :'
|
|
30
|
+
operation: :'BackupUnitsApi.backupunits_ssourl_get',
|
|
31
31
|
return_type: 'BackupUnitSSO',
|
|
32
32
|
result: backupunit_sso,
|
|
33
33
|
},
|
|
@@ -59,7 +59,7 @@ describe Chef::Knife::IonoscloudBackupunitSsourl do
|
|
|
59
59
|
{
|
|
60
60
|
method: 'GET',
|
|
61
61
|
path: "/backupunits/#{backupunit_id}/ssourl",
|
|
62
|
-
operation: :'
|
|
62
|
+
operation: :'BackupUnitsApi.backupunits_ssourl_get',
|
|
63
63
|
return_type: 'BackupUnitSSO',
|
|
64
64
|
exception: Ionoscloud::ApiError.new(code: 404),
|
|
65
65
|
},
|
|
@@ -27,7 +27,7 @@ describe Chef::Knife::IonoscloudBaseTest do
|
|
|
27
27
|
{
|
|
28
28
|
method: 'GET',
|
|
29
29
|
path: "/requests/#{request_id}/status",
|
|
30
|
-
operation: :'
|
|
30
|
+
operation: :'RequestsApi.requests_status_get',
|
|
31
31
|
return_type: 'RequestStatus',
|
|
32
32
|
result: request_status,
|
|
33
33
|
},
|
|
@@ -47,7 +47,7 @@ describe Chef::Knife::IonoscloudBaseTest do
|
|
|
47
47
|
{
|
|
48
48
|
method: 'GET',
|
|
49
49
|
path: "/requests/#{request_id}/status",
|
|
50
|
-
operation: :'
|
|
50
|
+
operation: :'RequestsApi.requests_status_get',
|
|
51
51
|
return_type: 'RequestStatus',
|
|
52
52
|
result: request_status,
|
|
53
53
|
},
|
|
@@ -67,7 +67,7 @@ describe Chef::Knife::IonoscloudBaseTest do
|
|
|
67
67
|
{
|
|
68
68
|
method: 'GET',
|
|
69
69
|
path: "/requests/#{request_id}/status",
|
|
70
|
-
operation: :'
|
|
70
|
+
operation: :'RequestsApi.requests_status_get',
|
|
71
71
|
return_type: 'RequestStatus',
|
|
72
72
|
result: request_status,
|
|
73
73
|
},
|
|
@@ -89,7 +89,7 @@ describe Chef::Knife::IonoscloudBaseTest do
|
|
|
89
89
|
{
|
|
90
90
|
method: 'GET',
|
|
91
91
|
path: "/requests/#{request_id}/status",
|
|
92
|
-
operation: :'
|
|
92
|
+
operation: :'RequestsApi.requests_status_get',
|
|
93
93
|
return_type: 'RequestStatus',
|
|
94
94
|
result: request_status,
|
|
95
95
|
},
|
|
@@ -12,7 +12,7 @@ describe Chef::Knife::IonoscloudCompositeServerCreate do
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
describe '#run' do
|
|
15
|
-
it 'should call
|
|
15
|
+
it 'should call ServersApi.datacenters_servers_post with the expected arguments and output based on what it receives' do
|
|
16
16
|
server = server_mock({ volumes: Ionoscloud::Volumes.new(items: [volume_mock]), nics: Ionoscloud::Nics.new(items: [nic_mock]) })
|
|
17
17
|
subject_config = {
|
|
18
18
|
ionoscloud_username: 'email',
|
|
@@ -30,15 +30,16 @@ describe Chef::Knife::IonoscloudCompositeServerCreate do
|
|
|
30
30
|
type: server.entities.volumes.items.first.properties.type,
|
|
31
31
|
bus: server.entities.volumes.items.first.properties.bus,
|
|
32
32
|
volume_availability_zone: server.entities.volumes.items.first.properties.availability_zone,
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
image: server.entities.volumes.items.first.properties.image,
|
|
34
|
+
backupunit_id: server.entities.volumes.items.first.properties.backupunit_id,
|
|
35
|
+
user_data: server.entities.volumes.items.first.properties.user_data,
|
|
35
36
|
image_password: 'K3tTj8G14a3EgKyNeeiY',
|
|
36
37
|
|
|
37
38
|
lan: server.entities.nics.items.first.properties.lan,
|
|
38
39
|
nic_name: server.entities.nics.items.first.properties.name,
|
|
39
40
|
dhcp: server.entities.nics.items.first.properties.dhcp,
|
|
40
41
|
ips: server.entities.nics.items.first.properties.ips.join(','),
|
|
41
|
-
|
|
42
|
+
firewall_type: server.entities.nics.items.first.properties.firewall_type,
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
subject_config.each { |key, value| subject.config[key] = value }
|
|
@@ -56,13 +57,15 @@ describe Chef::Knife::IonoscloudCompositeServerCreate do
|
|
|
56
57
|
|
|
57
58
|
expected_entities = server.entities.to_hash
|
|
58
59
|
expected_entities[:volumes][:items][0].delete(:id)
|
|
59
|
-
expected_entities[:volumes][:items][0][:properties].delete(:image)
|
|
60
60
|
expected_entities[:nics][:items][0].delete(:id)
|
|
61
61
|
expected_entities[:nics][:items][0].delete(:entities)
|
|
62
62
|
expected_entities[:nics][:items][0][:properties].delete(:mac)
|
|
63
63
|
expected_entities[:nics][:items][0][:properties].delete(:firewallActive)
|
|
64
|
+
expected_entities[:nics][:items][0][:properties].delete(:deviceNumber)
|
|
65
|
+
expected_entities[:nics][:items][0][:properties].delete(:pciSlot)
|
|
64
66
|
|
|
65
|
-
expected_entities[:volumes][:items][0][:properties]
|
|
67
|
+
expected_entities[:volumes][:items][0][:properties].delete(:licenceType)
|
|
68
|
+
expected_entities[:volumes][:items][0][:properties][:image] = subject_config[:image]
|
|
66
69
|
expected_entities[:volumes][:items][0][:properties][:imagePassword] = subject_config[:image_password]
|
|
67
70
|
|
|
68
71
|
mock_wait_for(subject)
|
|
@@ -72,7 +75,7 @@ describe Chef::Knife::IonoscloudCompositeServerCreate do
|
|
|
72
75
|
{
|
|
73
76
|
method: 'POST',
|
|
74
77
|
path: "/datacenters/#{subject_config[:datacenter_id]}/servers",
|
|
75
|
-
operation: :'
|
|
78
|
+
operation: :'ServersApi.datacenters_servers_post',
|
|
76
79
|
return_type: 'Server',
|
|
77
80
|
body: { properties: expected_properties, entities: expected_entities },
|
|
78
81
|
result: server,
|
|
@@ -80,7 +83,7 @@ describe Chef::Knife::IonoscloudCompositeServerCreate do
|
|
|
80
83
|
{
|
|
81
84
|
method: 'GET',
|
|
82
85
|
path: "/datacenters/#{subject_config[:datacenter_id]}/servers/#{server.id}",
|
|
83
|
-
operation: :'
|
|
86
|
+
operation: :'ServersApi.datacenters_servers_find_by_id',
|
|
84
87
|
return_type: 'Server',
|
|
85
88
|
result: server,
|
|
86
89
|
},
|