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
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
require_relative 'ionoscloud_base'
|
|
2
|
+
|
|
3
|
+
class Chef
|
|
4
|
+
class Knife
|
|
5
|
+
class IonoscloudNetworkloadbalancerCreate < Knife
|
|
6
|
+
include Knife::IonoscloudBase
|
|
7
|
+
|
|
8
|
+
banner 'knife ionoscloud networkloadbalancer create (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 :name,
|
|
16
|
+
short: '-n NAME',
|
|
17
|
+
long: '--name NAME',
|
|
18
|
+
description: 'Name of the load balancer'
|
|
19
|
+
|
|
20
|
+
option :listener_lan,
|
|
21
|
+
short: '-l LISTENER_LAN_ID',
|
|
22
|
+
long: '--listener-lan LISTENER_LAN_ID',
|
|
23
|
+
description: 'Id of the listening LAN. (inbound)'
|
|
24
|
+
|
|
25
|
+
option :target_lan,
|
|
26
|
+
short: '-t TARGET_LAN_ID',
|
|
27
|
+
long: '--target-lan TARGET_LAN_ID',
|
|
28
|
+
description: 'Id of the balanced private target LAN. (outbound)'
|
|
29
|
+
|
|
30
|
+
option :ips,
|
|
31
|
+
short: '-i IP[,IP,...]',
|
|
32
|
+
long: '--ips IP[,IP,...]',
|
|
33
|
+
description: 'Collection of IP addresses of the Network Load Balancer. (inbound and outbound) '\
|
|
34
|
+
'IP of the listenerLan must be a customer reserved IP for the public load balancer '\
|
|
35
|
+
'and private IP for the private load balancer.'
|
|
36
|
+
|
|
37
|
+
option :lb_private_ips,
|
|
38
|
+
long: '--private-ips IP[,IP,...]',
|
|
39
|
+
description: 'Collection of private IP addresses with subnet mask of the Network Load Balancer. '\
|
|
40
|
+
'IPs must contain valid subnet mask. If user will not provide any IP then the system '\
|
|
41
|
+
'will generate one IP with /24 subnet.'
|
|
42
|
+
|
|
43
|
+
attr_reader :description, :required_options
|
|
44
|
+
|
|
45
|
+
def initialize(args = [])
|
|
46
|
+
super(args)
|
|
47
|
+
@description =
|
|
48
|
+
'Creates an Network Load Balancer within the datacenter.'
|
|
49
|
+
@required_options = [:datacenter_id, :name, :listener_lan, :target_lan, :ips, :ionoscloud_username, :ionoscloud_password]
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def run
|
|
53
|
+
$stdout.sync = true
|
|
54
|
+
validate_required_params(@required_options, config)
|
|
55
|
+
|
|
56
|
+
print "#{ui.color('Creating Network Load Balancer...', :magenta)}"
|
|
57
|
+
|
|
58
|
+
config[:ips] = config[:ips].split(',') if config[:ips]
|
|
59
|
+
config[:lb_private_ips] = config[:lb_private_ips].split(',') if config[:lb_private_ips]
|
|
60
|
+
|
|
61
|
+
network_load_balancers_api = Ionoscloud::NetworkLoadBalancersApi.new(api_client)
|
|
62
|
+
|
|
63
|
+
network_load_balancer, _, headers = network_load_balancers_api.datacenters_networkloadbalancers_post_with_http_info(
|
|
64
|
+
config[:datacenter_id],
|
|
65
|
+
Ionoscloud::NetworkLoadBalancer.new(
|
|
66
|
+
properties: Ionoscloud::NetworkLoadBalancerProperties.new({
|
|
67
|
+
name: config[:name],
|
|
68
|
+
ips: config[:ips],
|
|
69
|
+
listener_lan: config[:listener_lan],
|
|
70
|
+
target_lan: config[:target_lan],
|
|
71
|
+
lb_private_ips: config[:lb_private_ips],
|
|
72
|
+
}.compact),
|
|
73
|
+
),
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
dot = ui.color('.', :magenta)
|
|
78
|
+
api_client.wait_for { print dot; is_done? get_request_id headers }
|
|
79
|
+
|
|
80
|
+
network_load_balancer = network_load_balancers_api.datacenters_networkloadbalancers_find_by_network_load_balancer_id(
|
|
81
|
+
config[:datacenter_id], network_load_balancer.id,
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
puts "\n"
|
|
85
|
+
puts "#{ui.color('ID', :cyan)}: #{network_load_balancer.id}"
|
|
86
|
+
puts "#{ui.color('Name', :cyan)}: #{network_load_balancer.properties.name}"
|
|
87
|
+
puts "#{ui.color('Listener LAN', :cyan)}: #{network_load_balancer.properties.listener_lan}"
|
|
88
|
+
puts "#{ui.color('IPS', :cyan)}: #{network_load_balancer.properties.ips}"
|
|
89
|
+
puts "#{ui.color('Target LAN', :cyan)}: #{network_load_balancer.properties.target_lan}"
|
|
90
|
+
puts "#{ui.color('Private IPS', :cyan)}: #{network_load_balancer.properties.lb_private_ips}"
|
|
91
|
+
puts 'done'
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
require_relative 'ionoscloud_base'
|
|
2
|
+
|
|
3
|
+
class Chef
|
|
4
|
+
class Knife
|
|
5
|
+
class IonoscloudNetworkloadbalancerDelete < Knife
|
|
6
|
+
include Knife::IonoscloudBase
|
|
7
|
+
|
|
8
|
+
banner 'knife ionoscloud networkloadbalancer delete LOAD_BALANCER_ID [LOAD_BALANCER_ID] (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
|
+
attr_reader :description, :required_options
|
|
16
|
+
|
|
17
|
+
def initialize(args = [])
|
|
18
|
+
super(args)
|
|
19
|
+
@description =
|
|
20
|
+
'Removes the specified Network Load Balancer.'
|
|
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
|
+
network_load_balancers_api = Ionoscloud::NetworkLoadBalancersApi.new(api_client)
|
|
29
|
+
|
|
30
|
+
@name_args.each do |network_load_balancer_id|
|
|
31
|
+
begin
|
|
32
|
+
network_load_balancer = network_load_balancers_api.datacenters_networkloadbalancers_find_by_network_load_balancer_id(
|
|
33
|
+
config[:datacenter_id],
|
|
34
|
+
network_load_balancer_id,
|
|
35
|
+
{ depth: 1 },
|
|
36
|
+
)
|
|
37
|
+
rescue Ionoscloud::ApiError => err
|
|
38
|
+
raise err unless err.code == 404
|
|
39
|
+
ui.error("Network Load balancer ID #{network_load_balancer_id} not found. Skipping.")
|
|
40
|
+
next
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
msg_pair('ID', network_load_balancer.id)
|
|
44
|
+
msg_pair('Name', network_load_balancer.properties.name)
|
|
45
|
+
msg_pair('Listener LAN', network_load_balancer.properties.listener_lan)
|
|
46
|
+
msg_pair('IPS', network_load_balancer.properties.ips)
|
|
47
|
+
msg_pair('Target LAN', network_load_balancer.properties.target_lan)
|
|
48
|
+
msg_pair('Private IPS', network_load_balancer.properties.lb_private_ips)
|
|
49
|
+
msg_pair('Forwarding Rules', network_load_balancer.entities.forwardingrules.items.map do |rule|
|
|
50
|
+
{
|
|
51
|
+
id: rule.id,
|
|
52
|
+
name: rule.properties.name,
|
|
53
|
+
algorithm: rule.properties.algorithm,
|
|
54
|
+
protocol: rule.properties.protocol,
|
|
55
|
+
listener_ip: rule.properties.listener_ip,
|
|
56
|
+
listener_port: rule.properties.listener_port,
|
|
57
|
+
health_check: rule.properties.health_check,
|
|
58
|
+
targets: rule.properties.targets,
|
|
59
|
+
}
|
|
60
|
+
end
|
|
61
|
+
)
|
|
62
|
+
# msg_pair('Flowlogs', network_load_balancer.entities.flowlogs.items.map { |flowlog| flowlog.id })
|
|
63
|
+
|
|
64
|
+
puts "\n"
|
|
65
|
+
|
|
66
|
+
begin
|
|
67
|
+
confirm('Do you really want to delete this Network Load balancer')
|
|
68
|
+
rescue SystemExit => exc
|
|
69
|
+
next
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
_, _, headers = network_load_balancers_api.datacenters_networkloadbalancers_delete_with_http_info(
|
|
73
|
+
config[:datacenter_id],
|
|
74
|
+
network_load_balancer_id,
|
|
75
|
+
)
|
|
76
|
+
ui.warn("Deleted Network Load balancer #{network_load_balancer.id}. Request ID: #{get_request_id headers}")
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
require_relative 'ionoscloud_base'
|
|
2
|
+
|
|
3
|
+
class Chef
|
|
4
|
+
class Knife
|
|
5
|
+
class IonoscloudNetworkloadbalancerList < Knife
|
|
6
|
+
include Knife::IonoscloudBase
|
|
7
|
+
|
|
8
|
+
banner 'knife ionoscloud networkloadbalancer list (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
|
+
attr_reader :description, :required_options
|
|
16
|
+
|
|
17
|
+
def initialize(args = [])
|
|
18
|
+
super(args)
|
|
19
|
+
@description =
|
|
20
|
+
'Retrieve a list of Network Load Balancers within the datacenter.'
|
|
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
|
+
network_load_balancers_list = [
|
|
29
|
+
ui.color('ID', :bold),
|
|
30
|
+
ui.color('Name', :bold),
|
|
31
|
+
ui.color('Listener LAN', :bold),
|
|
32
|
+
ui.color('Target LAN', :bold),
|
|
33
|
+
ui.color('Rules', :bold),
|
|
34
|
+
ui.color('Flowlogs', :bold),
|
|
35
|
+
ui.color('IPS', :bold),
|
|
36
|
+
ui.color('Private IPS', :bold),
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
network_load_balancers_api = Ionoscloud::NetworkLoadBalancersApi.new(api_client)
|
|
40
|
+
|
|
41
|
+
network_load_balancers_api.datacenters_networkloadbalancers_get(config[:datacenter_id], { depth: 2 }).items.each do |network_load_balancer|
|
|
42
|
+
network_load_balancers_list << network_load_balancer.id
|
|
43
|
+
network_load_balancers_list << network_load_balancer.properties.name
|
|
44
|
+
network_load_balancers_list << network_load_balancer.properties.listener_lan
|
|
45
|
+
network_load_balancers_list << network_load_balancer.properties.target_lan
|
|
46
|
+
network_load_balancers_list << network_load_balancer.entities.forwardingrules.items.length
|
|
47
|
+
network_load_balancers_list << network_load_balancer.entities.flowlogs.items.length
|
|
48
|
+
network_load_balancers_list << network_load_balancer.properties.ips
|
|
49
|
+
network_load_balancers_list << network_load_balancer.properties.lb_private_ips
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
puts ui.list(network_load_balancers_list, :uneven_columns_across, 8)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
require_relative 'ionoscloud_base'
|
|
2
|
+
|
|
3
|
+
class Chef
|
|
4
|
+
class Knife
|
|
5
|
+
class IonoscloudNetworkloadbalancerRuleAdd < Knife
|
|
6
|
+
include Knife::IonoscloudBase
|
|
7
|
+
|
|
8
|
+
banner 'knife ionoscloud networkloadbalancer rule add (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 :network_loadbalancer_id,
|
|
16
|
+
short: '-L NETWORK_LOADBALANCER_ID',
|
|
17
|
+
long: '--network-loadbalancer NETWORK_LOADBALANCER_ID',
|
|
18
|
+
description: 'ID of the Network Loadbalancer'
|
|
19
|
+
|
|
20
|
+
option :name,
|
|
21
|
+
short: '-n NAME',
|
|
22
|
+
long: '--name NAME',
|
|
23
|
+
description: 'A name of that Network Load Balancer forwarding rule'
|
|
24
|
+
|
|
25
|
+
option :algorithm,
|
|
26
|
+
short: '-a ALGORITHM',
|
|
27
|
+
long: '--algorithm ALGORITHM',
|
|
28
|
+
description: 'Algorithm for the balancing',
|
|
29
|
+
default: 'ROUND_ROBIN'
|
|
30
|
+
|
|
31
|
+
option :protocol,
|
|
32
|
+
long: '--protocol PROTOCOL',
|
|
33
|
+
description: 'Protocol of the balancing',
|
|
34
|
+
default: 'TCP'
|
|
35
|
+
|
|
36
|
+
option :listener_ip,
|
|
37
|
+
short: '-i LISTENER_IP',
|
|
38
|
+
long: '--ip LISTENER_IP',
|
|
39
|
+
description: 'Listening IP. (inbound)'
|
|
40
|
+
|
|
41
|
+
option :listener_port,
|
|
42
|
+
short: '-p LISTENER_PORT',
|
|
43
|
+
long: '--port LISTENER_PORT',
|
|
44
|
+
description: 'Listening port number. (inbound) (range: 1 to 65535)'
|
|
45
|
+
|
|
46
|
+
option :client_timeout,
|
|
47
|
+
long: '--client-timeout CLIENT_TIMEOUT',
|
|
48
|
+
description: 'ClientTimeout is expressed in milliseconds. This inactivity timeout applies when '\
|
|
49
|
+
'the client is expected to acknowledge or send data. If unset the default of 50 seconds will be used.',
|
|
50
|
+
default: 50
|
|
51
|
+
|
|
52
|
+
option :check_timeout,
|
|
53
|
+
long: '--check-timeout CLIENT_TIMEOUT',
|
|
54
|
+
description: 'It specifies the time (in milliseconds) for a target VM in this pool to answer the check. '\
|
|
55
|
+
'If a target VM has CheckInterval set and CheckTimeout is set too, then the smaller value of the two is '\
|
|
56
|
+
'used after the TCP connection is established.',
|
|
57
|
+
default: 2000
|
|
58
|
+
|
|
59
|
+
option :connect_timeout,
|
|
60
|
+
long: '--connect-timeout CONNECT_TIMEOUT',
|
|
61
|
+
description: 'It specifies the maximum time (in milliseconds) to wait for a connection attempt to a '\
|
|
62
|
+
'target VM to succeed. If unset, the default of 5 seconds will be used.',
|
|
63
|
+
default: 5000
|
|
64
|
+
|
|
65
|
+
option :target_timeout,
|
|
66
|
+
long: '--terget-timeout TARGET_TIMEOUT',
|
|
67
|
+
description: 'TargetTimeout specifies the maximum inactivity time (in milliseconds) on the target VM side. '\
|
|
68
|
+
'If unset, the default of 50 seconds will be used.',
|
|
69
|
+
default: 50000
|
|
70
|
+
|
|
71
|
+
option :retries,
|
|
72
|
+
short: '-r RETRIES',
|
|
73
|
+
long: '--retries RETRIES',
|
|
74
|
+
description: 'Retries specifies the number of retries to perform on a target VM after a connection failure. '\
|
|
75
|
+
'If unset, the default value of 3 will be used. (valid range: [0, 65535])',
|
|
76
|
+
default: 3
|
|
77
|
+
|
|
78
|
+
attr_reader :description, :required_options
|
|
79
|
+
|
|
80
|
+
def initialize(args = [])
|
|
81
|
+
super(args)
|
|
82
|
+
@description =
|
|
83
|
+
'Adds a Forwarding Rule to a Network Load Balancer under a data center.'
|
|
84
|
+
@required_options = [:datacenter_id, :network_loadbalancer_id, :name, :listener_ip, :listener_port, :ionoscloud_username, :ionoscloud_password]
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def run
|
|
88
|
+
$stdout.sync = true
|
|
89
|
+
validate_required_params(@required_options, config)
|
|
90
|
+
|
|
91
|
+
network_loadbalancers_api = Ionoscloud::NetworkLoadBalancersApi.new(api_client)
|
|
92
|
+
|
|
93
|
+
if config[:gateway_ips]
|
|
94
|
+
config[:gateway_ips] = config[:gateway_ips].split(',')
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
network_loadbalancer_forwarding_rule = Ionoscloud::NetworkLoadBalancerForwardingRule.new(
|
|
98
|
+
properties: Ionoscloud::NetworkLoadBalancerForwardingRuleProperties.new(
|
|
99
|
+
name: config[:name],
|
|
100
|
+
algorithm: config[:algorithm],
|
|
101
|
+
protocol: config[:protocol],
|
|
102
|
+
listener_ip: config[:listener_ip],
|
|
103
|
+
listener_port: config[:listener_port],
|
|
104
|
+
health_check: Ionoscloud::NetworkLoadBalancerForwardingRuleHealthCheck.new(
|
|
105
|
+
client_timeout: config[:client_timeout],
|
|
106
|
+
check_timeout: config[:check_timeout],
|
|
107
|
+
connect_timeout: config[:connect_timeout],
|
|
108
|
+
target_timeout: config[:target_timeout],
|
|
109
|
+
retries: config[:retries],
|
|
110
|
+
),
|
|
111
|
+
),
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
_, _, headers = network_loadbalancers_api.datacenters_networkloadbalancers_forwardingrules_post_with_http_info(
|
|
115
|
+
config[:datacenter_id], config[:network_loadbalancer_id], network_loadbalancer_forwarding_rule,
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
print "#{ui.color('Adding the rule to the Network Loadbalancer...', :magenta)}"
|
|
119
|
+
dot = ui.color('.', :magenta)
|
|
120
|
+
api_client.wait_for { print dot; is_done? get_request_id headers }
|
|
121
|
+
|
|
122
|
+
network_load_balancer = network_loadbalancers_api.datacenters_networkloadbalancers_find_by_network_load_balancer_id(
|
|
123
|
+
config[:datacenter_id], config[:network_loadbalancer_id], depth: 2,
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
puts "\n"
|
|
127
|
+
puts "#{ui.color('ID', :cyan)}: #{network_load_balancer.id}"
|
|
128
|
+
puts "#{ui.color('Name', :cyan)}: #{network_load_balancer.properties.name}"
|
|
129
|
+
puts "#{ui.color('Listener LAN', :cyan)}: #{network_load_balancer.properties.listener_lan}"
|
|
130
|
+
puts "#{ui.color('IPS', :cyan)}: #{network_load_balancer.properties.ips}"
|
|
131
|
+
puts "#{ui.color('Target LAN', :cyan)}: #{network_load_balancer.properties.target_lan}"
|
|
132
|
+
puts "#{ui.color('Private IPS', :cyan)}: #{network_load_balancer.properties.lb_private_ips}"
|
|
133
|
+
puts "#{ui.color('Forwarding Rules', :cyan)}: #{network_load_balancer.entities.forwardingrules.items.map do |rule|
|
|
134
|
+
{
|
|
135
|
+
id: rule.id,
|
|
136
|
+
name: rule.properties.name,
|
|
137
|
+
algorithm: rule.properties.algorithm,
|
|
138
|
+
protocol: rule.properties.protocol,
|
|
139
|
+
listener_ip: rule.properties.listener_ip,
|
|
140
|
+
listener_port: rule.properties.listener_port,
|
|
141
|
+
health_check: rule.properties.health_check,
|
|
142
|
+
targets: rule.properties.targets,
|
|
143
|
+
}
|
|
144
|
+
end}"
|
|
145
|
+
puts "#{ui.color('Flowlogs', :cyan)}: #{network_load_balancer.entities.flowlogs.items.map { |flowlog| flowlog.id }}"
|
|
146
|
+
puts 'done'
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
end
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
require_relative 'ionoscloud_base'
|
|
2
|
+
|
|
3
|
+
class Chef
|
|
4
|
+
class Knife
|
|
5
|
+
class IonoscloudNetworkloadbalancerRuleList < Knife
|
|
6
|
+
include Knife::IonoscloudBase
|
|
7
|
+
|
|
8
|
+
banner 'knife ionoscloud networkloadbalancer rule list (options)'
|
|
9
|
+
|
|
10
|
+
option :datacenter_id,
|
|
11
|
+
short: '-D DATACENTER_ID',
|
|
12
|
+
long: '--datacenter-id DATACENTER_ID',
|
|
13
|
+
description: 'The ID of the data center'
|
|
14
|
+
|
|
15
|
+
option :network_loadbalancer_id,
|
|
16
|
+
short: '-L NETWORK_LOADBALANCER_ID',
|
|
17
|
+
long: '--network-loadbalancer NETWORK_LOADBALANCER_ID',
|
|
18
|
+
description: 'ID of the Network Loadbalancer'
|
|
19
|
+
|
|
20
|
+
attr_reader :description, :required_options
|
|
21
|
+
|
|
22
|
+
def initialize(args = [])
|
|
23
|
+
super(args)
|
|
24
|
+
@description =
|
|
25
|
+
'Lists all available rules in a Network Loadbalancer under a data center.'
|
|
26
|
+
@required_options = [:datacenter_id, :network_loadbalancer_id, :ionoscloud_username, :ionoscloud_password]
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def run
|
|
30
|
+
$stdout.sync = true
|
|
31
|
+
validate_required_params(@required_options, config)
|
|
32
|
+
|
|
33
|
+
$stdout.sync = true
|
|
34
|
+
network_loadbalancer_rule_list = [
|
|
35
|
+
ui.color('ID', :bold),
|
|
36
|
+
ui.color('Name', :bold),
|
|
37
|
+
ui.color('Algorithm', :bold),
|
|
38
|
+
ui.color('Protocol', :bold),
|
|
39
|
+
ui.color('Listener IP', :bold),
|
|
40
|
+
ui.color('Listener Port', :bold),
|
|
41
|
+
ui.color('Targets', :bold),
|
|
42
|
+
ui.color('Health Check', :bold),
|
|
43
|
+
]
|
|
44
|
+
network_loadbalancers_api = Ionoscloud::NetworkLoadBalancersApi.new(api_client)
|
|
45
|
+
|
|
46
|
+
network_loadbalancers_api.datacenters_networkloadbalancers_forwardingrules_get(
|
|
47
|
+
config[:datacenter_id], config[:network_loadbalancer_id], depth: 1,
|
|
48
|
+
).items.each do |network_loadbalancer_rule|
|
|
49
|
+
network_loadbalancer_rule_list << network_loadbalancer_rule.id
|
|
50
|
+
network_loadbalancer_rule_list << network_loadbalancer_rule.properties.name
|
|
51
|
+
network_loadbalancer_rule_list << network_loadbalancer_rule.properties.algorithm
|
|
52
|
+
network_loadbalancer_rule_list << network_loadbalancer_rule.properties.protocol
|
|
53
|
+
network_loadbalancer_rule_list << network_loadbalancer_rule.properties.listener_ip
|
|
54
|
+
network_loadbalancer_rule_list << network_loadbalancer_rule.properties.listener_port
|
|
55
|
+
network_loadbalancer_rule_list << network_loadbalancer_rule.properties.targets.length
|
|
56
|
+
network_loadbalancer_rule_list << network_loadbalancer_rule.properties.health_check
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
puts ui.list(network_loadbalancer_rule_list, :uneven_columns_across, 8)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|