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
|
@@ -20,7 +20,7 @@ class Chef
|
|
|
20
20
|
$stdout.sync = true
|
|
21
21
|
validate_required_params(@required_options, config)
|
|
22
22
|
|
|
23
|
-
pcc_api = Ionoscloud::
|
|
23
|
+
pcc_api = Ionoscloud::PrivateCrossConnectsApi.new(api_client)
|
|
24
24
|
|
|
25
25
|
@name_args.each do |pcc_id|
|
|
26
26
|
begin
|
|
@@ -26,7 +26,7 @@ class Chef
|
|
|
26
26
|
ui.color('Description', :bold),
|
|
27
27
|
]
|
|
28
28
|
|
|
29
|
-
pcc_api = Ionoscloud::
|
|
29
|
+
pcc_api = Ionoscloud::PrivateCrossConnectsApi.new(api_client)
|
|
30
30
|
|
|
31
31
|
pcc_api.pccs_get({ depth: 1 }).items.each do |pcc|
|
|
32
32
|
pcc_list << pcc.id
|
|
@@ -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::RequestsApi.new(api_client).requests_status_get(config[:request_id]).metadata.status
|
|
30
30
|
rescue Ionoscloud::ApiError => err
|
|
31
31
|
raise err unless err.code == 404
|
|
32
32
|
ui.error("Request ID #{config[:request_id]} not found.")
|
|
@@ -27,9 +27,9 @@ class Chef
|
|
|
27
27
|
|
|
28
28
|
print "#{ui.color('Creating S3key...', :magenta)}"
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
user_s3keys_api = Ionoscloud::UserS3KeysApi.new(api_client)
|
|
31
31
|
|
|
32
|
-
s3_key, _, headers =
|
|
32
|
+
s3_key, _, headers = user_s3keys_api.um_users_s3keys_post_with_http_info(config[:user_id])
|
|
33
33
|
|
|
34
34
|
dot = ui.color('.', :magenta)
|
|
35
35
|
api_client.wait_for { print dot; is_done? get_request_id headers }
|
|
@@ -25,11 +25,11 @@ class Chef
|
|
|
25
25
|
$stdout.sync = true
|
|
26
26
|
validate_required_params(@required_options, config)
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
user_s3keys_api = Ionoscloud::UserS3KeysApi.new(api_client)
|
|
29
29
|
|
|
30
30
|
@name_args.each do |s3key_id|
|
|
31
31
|
begin
|
|
32
|
-
s3_key =
|
|
32
|
+
s3_key = user_s3keys_api.um_users_s3keys_find_by_key_id(config[:user_id], s3key_id)
|
|
33
33
|
rescue Ionoscloud::ApiError => err
|
|
34
34
|
raise err unless err.code == 404
|
|
35
35
|
ui.error("S3 key ID #{s3key_id} not found. Skipping.")
|
|
@@ -48,7 +48,7 @@ class Chef
|
|
|
48
48
|
next
|
|
49
49
|
end
|
|
50
50
|
|
|
51
|
-
_, _, headers =
|
|
51
|
+
_, _, headers = user_s3keys_api.um_users_s3keys_delete_with_http_info(config[:user_id], s3key_id)
|
|
52
52
|
ui.warn("Deleted S3 key #{s3_key.id}. Request ID: #{get_request_id headers}")
|
|
53
53
|
end
|
|
54
54
|
end
|
|
@@ -31,9 +31,9 @@ class Chef
|
|
|
31
31
|
ui.color('Active', :bold),
|
|
32
32
|
]
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
user_s3keys_api = Ionoscloud::UserS3KeysApi.new(api_client)
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
user_s3keys_api.um_users_s3keys_get(config[:user_id], { depth: 1 }).items.each do |s3_key|
|
|
37
37
|
s3key_list << s3_key.id
|
|
38
38
|
s3key_list << s3_key.properties.secret_key
|
|
39
39
|
s3key_list << s3_key.properties.active.to_s
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require_relative 'ionoscloud_base'
|
|
2
|
+
|
|
3
|
+
class Chef
|
|
4
|
+
class Knife
|
|
5
|
+
class IonoscloudServerConsole < Knife
|
|
6
|
+
include Knife::IonoscloudBase
|
|
7
|
+
|
|
8
|
+
banner 'knife ionoscloud server console (options)'
|
|
9
|
+
|
|
10
|
+
option :datacenter_id,
|
|
11
|
+
short: '-D DATACENTER_ID',
|
|
12
|
+
long: '--datacenter-id DATACENTER_ID',
|
|
13
|
+
description: 'The ID of the Datacenter.'
|
|
14
|
+
|
|
15
|
+
option :server_id,
|
|
16
|
+
short: '-S SERVER_ID',
|
|
17
|
+
long: '--server-id SERVER_ID',
|
|
18
|
+
description: 'The ID of the Server.'
|
|
19
|
+
|
|
20
|
+
attr_reader :description, :required_options
|
|
21
|
+
|
|
22
|
+
def initialize(args = [])
|
|
23
|
+
super(args)
|
|
24
|
+
@description =
|
|
25
|
+
'Returns the link with the jwToken to access the server remote console.'
|
|
26
|
+
@required_options = [:datacenter_id, :server_id, :ionoscloud_username, :ionoscloud_password]
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def run
|
|
30
|
+
$stdout.sync = true
|
|
31
|
+
validate_required_params(@required_options, config)
|
|
32
|
+
|
|
33
|
+
begin
|
|
34
|
+
puts Ionoscloud::ServersApi.new(api_client).datacenters_servers_remote_console_get(config[:datacenter_id], config[:server_id]).url
|
|
35
|
+
rescue Ionoscloud::ApiError => err
|
|
36
|
+
raise err unless err.code == 404
|
|
37
|
+
ui.error("Server ID #{config[:server_id]} not found.")
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -67,25 +67,25 @@ class Chef
|
|
|
67
67
|
params = {
|
|
68
68
|
name: config[:name],
|
|
69
69
|
cores: config[:cores],
|
|
70
|
-
|
|
70
|
+
cpu_family: config[:cpu_family],
|
|
71
71
|
ram: config[:ram],
|
|
72
|
-
|
|
72
|
+
availability_zone: config[:availability_zone],
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
params[:
|
|
76
|
-
params[:
|
|
75
|
+
params[:boot_cdrom] = { id: config[:boot_cdrom] } unless config[:boot_cdrom].nil?
|
|
76
|
+
params[:boot_volume] = { id: config[:boot_volume] } unless config[:boot_volume].nil?
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
servers_api = Ionoscloud::ServersApi.new(api_client)
|
|
79
79
|
|
|
80
|
-
server, _, headers =
|
|
80
|
+
server, _, headers = servers_api.datacenters_servers_post_with_http_info(
|
|
81
81
|
config[:datacenter_id],
|
|
82
|
-
|
|
82
|
+
Ionoscloud::Server.new(properties: Ionoscloud::ServerProperties.new(params.compact)),
|
|
83
83
|
)
|
|
84
84
|
|
|
85
85
|
dot = ui.color('.', :magenta)
|
|
86
86
|
api_client.wait_for { print dot; is_done? get_request_id headers }
|
|
87
87
|
|
|
88
|
-
server =
|
|
88
|
+
server = servers_api.datacenters_servers_find_by_id(config[:datacenter_id], server.id)
|
|
89
89
|
|
|
90
90
|
puts "\n"
|
|
91
91
|
puts "#{ui.color('ID', :cyan)}: #{server.id}"
|
|
@@ -12,6 +12,11 @@ class Chef
|
|
|
12
12
|
long: '--datacenter-id DATACENTER_ID',
|
|
13
13
|
description: 'The ID of the datacenter containing the server'
|
|
14
14
|
|
|
15
|
+
option :upgrade_needed,
|
|
16
|
+
short: '-u',
|
|
17
|
+
long: '--upgrade-needed',
|
|
18
|
+
description: 'It can be used to filter which servers can be upgraded'
|
|
19
|
+
|
|
15
20
|
attr_reader :description, :required_options
|
|
16
21
|
|
|
17
22
|
def initialize(args = [])
|
|
@@ -28,30 +33,36 @@ class Chef
|
|
|
28
33
|
server_list = [
|
|
29
34
|
ui.color('ID', :bold),
|
|
30
35
|
ui.color('Name', :bold),
|
|
36
|
+
ui.color('Type', :bold),
|
|
37
|
+
ui.color('Template', :bold),
|
|
31
38
|
ui.color('Cores', :bold),
|
|
32
39
|
ui.color('CPU Family', :bold),
|
|
33
40
|
ui.color('RAM', :bold),
|
|
34
|
-
ui.color('Availability Zone', :bold),
|
|
35
41
|
ui.color('VM State', :bold),
|
|
36
42
|
ui.color('Boot Volume', :bold),
|
|
37
43
|
ui.color('Boot CDROM', :bold),
|
|
38
44
|
]
|
|
39
45
|
|
|
40
|
-
server_api = Ionoscloud::
|
|
46
|
+
server_api = Ionoscloud::ServersApi.new(api_client)
|
|
47
|
+
|
|
48
|
+
opts = { depth: 1 }
|
|
49
|
+
|
|
50
|
+
opts[:upgrade_needed] = config[:upgrade_needed] if config[:upgrade_needed]
|
|
41
51
|
|
|
42
|
-
server_api.datacenters_servers_get(config[:datacenter_id],
|
|
52
|
+
server_api.datacenters_servers_get(config[:datacenter_id], opts).items.each do |server|
|
|
43
53
|
server_list << server.id
|
|
44
54
|
server_list << server.properties.name
|
|
55
|
+
server_list << server.properties.type
|
|
56
|
+
server_list << server.properties.template_uuid
|
|
45
57
|
server_list << server.properties.cores.to_s
|
|
46
58
|
server_list << server.properties.cpu_family
|
|
47
59
|
server_list << server.properties.ram.to_s
|
|
48
|
-
server_list << server.properties.availability_zone
|
|
49
60
|
server_list << server.properties.vm_state
|
|
50
61
|
server_list << (server.properties.boot_volume.nil? ? '' : server.properties.boot_volume.id)
|
|
51
62
|
server_list << (server.properties.boot_cdrom.nil? ? '' : server.properties.boot_cdrom.id)
|
|
52
63
|
end
|
|
53
64
|
|
|
54
|
-
puts ui.list(server_list, :uneven_columns_across,
|
|
65
|
+
puts ui.list(server_list, :uneven_columns_across, 10)
|
|
55
66
|
end
|
|
56
67
|
end
|
|
57
68
|
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
require_relative 'ionoscloud_base'
|
|
2
|
+
|
|
3
|
+
class Chef
|
|
4
|
+
class Knife
|
|
5
|
+
class IonoscloudServerResume < Knife
|
|
6
|
+
include Knife::IonoscloudBase
|
|
7
|
+
|
|
8
|
+
banner 'knife ionoscloud server resume SERVER_ID [SERVER_ID] (options)'
|
|
9
|
+
|
|
10
|
+
option :datacenter_id,
|
|
11
|
+
short: '-D DATACENTER_ID',
|
|
12
|
+
long: '--datacenter-id DATACENTER_ID',
|
|
13
|
+
description: 'ID of the data center'
|
|
14
|
+
|
|
15
|
+
attr_reader :description, :required_options
|
|
16
|
+
|
|
17
|
+
def initialize(args = [])
|
|
18
|
+
super(args)
|
|
19
|
+
@description =
|
|
20
|
+
'This will resume a suspended server. The operation can only be applied to suspended Cube servers. No billing event will be generated.'
|
|
21
|
+
@required_options = [:datacenter_id, :ionoscloud_username, :ionoscloud_password]
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def run
|
|
25
|
+
$stdout.sync = true
|
|
26
|
+
validate_required_params(@required_options, config)
|
|
27
|
+
|
|
28
|
+
server_api = Ionoscloud::ServersApi.new(api_client)
|
|
29
|
+
|
|
30
|
+
@name_args.each do |server_id|
|
|
31
|
+
begin
|
|
32
|
+
_, _, headers = server_api.datacenters_servers_resume_post_with_http_info(config[:datacenter_id], server_id)
|
|
33
|
+
rescue Ionoscloud::ApiError => err
|
|
34
|
+
raise err unless err.code == 404
|
|
35
|
+
ui.error("Server ID #{server_id} not found. Skipping.")
|
|
36
|
+
next
|
|
37
|
+
end
|
|
38
|
+
ui.info("Server #{server_id} is resuming. Request ID: #{get_request_id headers}")
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
require_relative 'ionoscloud_base'
|
|
2
|
+
|
|
3
|
+
class Chef
|
|
4
|
+
class Knife
|
|
5
|
+
class IonoscloudServerSuspend < Knife
|
|
6
|
+
include Knife::IonoscloudBase
|
|
7
|
+
|
|
8
|
+
banner 'knife ionoscloud server suspend SERVER_ID [SERVER_ID] (options)'
|
|
9
|
+
|
|
10
|
+
option :datacenter_id,
|
|
11
|
+
short: '-D DATACENTER_ID',
|
|
12
|
+
long: '--datacenter-id DATACENTER_ID',
|
|
13
|
+
description: 'ID of the data center'
|
|
14
|
+
|
|
15
|
+
attr_reader :description, :required_options
|
|
16
|
+
|
|
17
|
+
def initialize(args = [])
|
|
18
|
+
super(args)
|
|
19
|
+
@description =
|
|
20
|
+
'This will suspend a server. The operation can only be applied to Cube servers. '\
|
|
21
|
+
'Note: The virtual machine will not be deleted, and the consumed resources will continue to be billed.'
|
|
22
|
+
@required_options = [:datacenter_id, :ionoscloud_username, :ionoscloud_password]
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def run
|
|
26
|
+
$stdout.sync = true
|
|
27
|
+
validate_required_params(@required_options, config)
|
|
28
|
+
|
|
29
|
+
server_api = Ionoscloud::ServersApi.new(api_client)
|
|
30
|
+
|
|
31
|
+
@name_args.each do |server_id|
|
|
32
|
+
begin
|
|
33
|
+
_, _, headers = server_api.datacenters_servers_suspend_post_with_http_info(config[:datacenter_id], server_id)
|
|
34
|
+
rescue Ionoscloud::ApiError => err
|
|
35
|
+
raise err unless err.code == 404
|
|
36
|
+
ui.error("Server ID #{server_id} not found. Skipping.")
|
|
37
|
+
next
|
|
38
|
+
end
|
|
39
|
+
ui.warn("Server #{server_id} is being suspended. Request ID: #{get_request_id headers}")
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require_relative 'ionoscloud_base'
|
|
2
|
+
|
|
3
|
+
class Chef
|
|
4
|
+
class Knife
|
|
5
|
+
class IonoscloudServerToken < Knife
|
|
6
|
+
include Knife::IonoscloudBase
|
|
7
|
+
|
|
8
|
+
banner 'knife ionoscloud server token (options)'
|
|
9
|
+
|
|
10
|
+
option :datacenter_id,
|
|
11
|
+
short: '-D DATACENTER_ID',
|
|
12
|
+
long: '--datacenter-id DATACENTER_ID',
|
|
13
|
+
description: 'The ID of the Datacenter.'
|
|
14
|
+
|
|
15
|
+
option :server_id,
|
|
16
|
+
short: '-S SERVER_ID',
|
|
17
|
+
long: '--server-id SERVER_ID',
|
|
18
|
+
description: 'The ID of the Server.'
|
|
19
|
+
|
|
20
|
+
attr_reader :description, :required_options
|
|
21
|
+
|
|
22
|
+
def initialize(args = [])
|
|
23
|
+
super(args)
|
|
24
|
+
@description =
|
|
25
|
+
'Returns the server json web token to be used for login operations (ex: accessing the server console).'
|
|
26
|
+
@required_options = [:datacenter_id, :server_id, :ionoscloud_username, :ionoscloud_password]
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def run
|
|
30
|
+
$stdout.sync = true
|
|
31
|
+
validate_required_params(@required_options, config)
|
|
32
|
+
|
|
33
|
+
begin
|
|
34
|
+
puts Ionoscloud::ServersApi.new(api_client).datacenters_servers_token_get(config[:datacenter_id], config[:server_id]).token
|
|
35
|
+
rescue Ionoscloud::ApiError => err
|
|
36
|
+
raise err unless err.code == 404
|
|
37
|
+
ui.error("Server ID #{config[:server_id]} not found.")
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
require_relative 'ionoscloud_base'
|
|
2
|
+
|
|
3
|
+
class Chef
|
|
4
|
+
class Knife
|
|
5
|
+
class IonoscloudServerUpgrade < Knife
|
|
6
|
+
include Knife::IonoscloudBase
|
|
7
|
+
|
|
8
|
+
banner 'knife ionoscloud server upgrade (options)'
|
|
9
|
+
|
|
10
|
+
option :datacenter_id,
|
|
11
|
+
short: '-D DATACENTER_ID',
|
|
12
|
+
long: '--datacenter-id DATACENTER_ID',
|
|
13
|
+
description: 'The ID of the Datacenter.'
|
|
14
|
+
|
|
15
|
+
option :server_id,
|
|
16
|
+
short: '-S SERVER_ID',
|
|
17
|
+
long: '--server-id SERVER_ID',
|
|
18
|
+
description: 'The ID of the Server.'
|
|
19
|
+
|
|
20
|
+
attr_reader :description, :required_options
|
|
21
|
+
|
|
22
|
+
def initialize(args = [])
|
|
23
|
+
super(args)
|
|
24
|
+
@description =
|
|
25
|
+
"This will upgrade the version of the server, if needed. To verify if there is an upgrade available for a server, "\
|
|
26
|
+
"call '/datacenters/{datacenterId}/servers?upgradeNeeded=true'."
|
|
27
|
+
@required_options = [:datacenter_id, :server_id, :ionoscloud_username, :ionoscloud_password]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def run
|
|
31
|
+
$stdout.sync = true
|
|
32
|
+
validate_required_params(@required_options, config)
|
|
33
|
+
|
|
34
|
+
begin
|
|
35
|
+
_, _, headers = Ionoscloud::ServersApi.new(api_client).datacenters_servers_upgrade_post(config[:datacenter_id], config[:server_id])
|
|
36
|
+
ui.info("Server #{config[:server_id]} is being upgraded. Request ID: #{get_request_id headers}")
|
|
37
|
+
rescue Ionoscloud::ApiError => err
|
|
38
|
+
raise err unless err.code == 404
|
|
39
|
+
ui.error("Server ID #{config[:server_id]} not found.")
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -51,7 +51,7 @@ class Chef
|
|
|
51
51
|
|
|
52
52
|
print "#{ui.color('Creating Snapshot...', :magenta)}"
|
|
53
53
|
|
|
54
|
-
volume_api = Ionoscloud::
|
|
54
|
+
volume_api = Ionoscloud::VolumesApi.new(api_client)
|
|
55
55
|
|
|
56
56
|
snapshot, _, headers = volume_api.datacenters_volumes_create_snapshot_post_with_http_info(
|
|
57
57
|
config[:datacenter_id],
|
|
@@ -67,7 +67,7 @@ class Chef
|
|
|
67
67
|
dot = ui.color('.', :magenta)
|
|
68
68
|
api_client.wait_for { print dot; is_done? get_request_id headers }
|
|
69
69
|
|
|
70
|
-
snapshot = Ionoscloud::
|
|
70
|
+
snapshot = Ionoscloud::SnapshotsApi.new(api_client).snapshots_find_by_id(snapshot.id)
|
|
71
71
|
|
|
72
72
|
puts "\n"
|
|
73
73
|
puts "#{ui.color('ID', :cyan)}: #{snapshot.id}"
|