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,78 @@
|
|
|
1
|
+
require_relative 'ionoscloud_base'
|
|
2
|
+
|
|
3
|
+
class Chef
|
|
4
|
+
class Knife
|
|
5
|
+
class IonoscloudNetworkloadbalancerRuleRemove < Knife
|
|
6
|
+
include Knife::IonoscloudBase
|
|
7
|
+
|
|
8
|
+
banner 'knife ionoscloud networkloadbalancer rule remove RULE_ID [RULE_ID] (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
|
+
'Removes the specified rules from 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
|
+
return unless @name_args.length > 0
|
|
34
|
+
|
|
35
|
+
network_loadbalancers_api = Ionoscloud::NetworkLoadBalancersApi.new(api_client)
|
|
36
|
+
|
|
37
|
+
headers_to_wait = []
|
|
38
|
+
@name_args.each do |rule_id|
|
|
39
|
+
_, _, headers = network_loadbalancers_api.datacenters_networkloadbalancers_forwardingrules_delete_with_http_info(
|
|
40
|
+
config[:datacenter_id], config[:network_loadbalancer_id], rule_id,
|
|
41
|
+
)
|
|
42
|
+
headers_to_wait << headers
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
print "#{ui.color("Removing rules #{@name_args} from the NAT Gateway...", :magenta)}"
|
|
46
|
+
dot = ui.color('.', :magenta)
|
|
47
|
+
|
|
48
|
+
headers_to_wait.each { |headers| api_client.wait_for { print dot; is_done? get_request_id headers } }
|
|
49
|
+
|
|
50
|
+
network_load_balancer = network_loadbalancers_api.datacenters_networkloadbalancers_find_by_network_load_balancer_id(
|
|
51
|
+
config[:datacenter_id], config[:network_loadbalancer_id], depth: 2,
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
puts "\n"
|
|
55
|
+
puts "#{ui.color('ID', :cyan)}: #{network_load_balancer.id}"
|
|
56
|
+
puts "#{ui.color('Name', :cyan)}: #{network_load_balancer.properties.name}"
|
|
57
|
+
puts "#{ui.color('Listener LAN', :cyan)}: #{network_load_balancer.properties.listener_lan}"
|
|
58
|
+
puts "#{ui.color('IPS', :cyan)}: #{network_load_balancer.properties.ips}"
|
|
59
|
+
puts "#{ui.color('Target LAN', :cyan)}: #{network_load_balancer.properties.target_lan}"
|
|
60
|
+
puts "#{ui.color('Private IPS', :cyan)}: #{network_load_balancer.properties.lb_private_ips}"
|
|
61
|
+
puts "#{ui.color('Forwarding Rules', :cyan)}: #{network_load_balancer.entities.forwardingrules.items.map do |rule|
|
|
62
|
+
{
|
|
63
|
+
id: rule.id,
|
|
64
|
+
name: rule.properties.name,
|
|
65
|
+
algorithm: rule.properties.algorithm,
|
|
66
|
+
protocol: rule.properties.protocol,
|
|
67
|
+
listener_ip: rule.properties.listener_ip,
|
|
68
|
+
listener_port: rule.properties.listener_port,
|
|
69
|
+
health_check: rule.properties.health_check,
|
|
70
|
+
targets: rule.properties.targets,
|
|
71
|
+
}
|
|
72
|
+
end}"
|
|
73
|
+
puts "#{ui.color('Flowlogs', :cyan)}: #{network_load_balancer.entities.flowlogs.items.map { |flowlog| flowlog.id }}"
|
|
74
|
+
puts 'done'
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
require_relative 'ionoscloud_base'
|
|
2
|
+
|
|
3
|
+
class Chef
|
|
4
|
+
class Knife
|
|
5
|
+
class IonoscloudNetworkloadbalancerRuleTargetAdd < Knife
|
|
6
|
+
include Knife::IonoscloudBase
|
|
7
|
+
|
|
8
|
+
banner 'knife ionoscloud networkloadbalancer rule target 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 :forwarding_rule_id,
|
|
21
|
+
short: '-R FORWARDING_RULE_ID',
|
|
22
|
+
long: '--forwarding-rule FORWARDING_RULE_ID',
|
|
23
|
+
description: 'ID of the Network Loadbalancer Forwarding Rule'
|
|
24
|
+
|
|
25
|
+
option :ip,
|
|
26
|
+
short: '-i IP',
|
|
27
|
+
long: '--ip IP',
|
|
28
|
+
description: 'IP of a balanced target VM'
|
|
29
|
+
|
|
30
|
+
option :port,
|
|
31
|
+
short: '-p PORT',
|
|
32
|
+
long: '--port PORT',
|
|
33
|
+
description: 'Port of the balanced target service. (range: 1 to 65535)'
|
|
34
|
+
|
|
35
|
+
option :weight,
|
|
36
|
+
short: '-w WEIGTH',
|
|
37
|
+
long: '--weight WEIGTH',
|
|
38
|
+
description: 'Weight parameter is used to adjust the target VM\'s weight relative to other target VMs. '\
|
|
39
|
+
'All target VMs will receive a load proportional to their weight relative to the sum of all weights, so '\
|
|
40
|
+
'the higher the weight, the higher the load. The default weight is 1, and the maximal value is 256. A '\
|
|
41
|
+
'value of 0 means the target VM will not participate in load-balancing but will still accept persistent '\
|
|
42
|
+
'connections. If this parameter is used to distribute the load according to target VM\'s capacity, it is '\
|
|
43
|
+
'recommended to start with values which can both grow and shrink, for instance between 10 and 100 to leave '\
|
|
44
|
+
'enough room above and below for later adjustments.'
|
|
45
|
+
|
|
46
|
+
option :check,
|
|
47
|
+
short: '-c',
|
|
48
|
+
long: '--check',
|
|
49
|
+
description: 'Check specifies whether the target VM\'s health is checked. If turned off, a target VM is '\
|
|
50
|
+
'always considered available. If turned on, the target VM is available when accepting periodic TCP connections, '\
|
|
51
|
+
'to ensure that it is really able to serve requests. The address and port to send the tests to are those of the '\
|
|
52
|
+
'target VM. The health check only consists of a connection attempt.',
|
|
53
|
+
boolean: true
|
|
54
|
+
|
|
55
|
+
option :check_interval,
|
|
56
|
+
long: '--check-interval CHECK_INTERVAL',
|
|
57
|
+
description: 'CheckInterval determines the duration (in milliseconds) between consecutive health checks. '\
|
|
58
|
+
'If unspecified a default of 2000 ms is used.',
|
|
59
|
+
default: 2000
|
|
60
|
+
|
|
61
|
+
option :maintenance,
|
|
62
|
+
short: '-m',
|
|
63
|
+
long: '--maintenance MAINTENANCE',
|
|
64
|
+
description: 'Maintenance specifies if a target VM should be marked as down, even if it is not.',
|
|
65
|
+
boolean: true
|
|
66
|
+
|
|
67
|
+
attr_reader :description, :required_options
|
|
68
|
+
|
|
69
|
+
def initialize(args = [])
|
|
70
|
+
super(args)
|
|
71
|
+
@description =
|
|
72
|
+
'Adds a target to a Network Load Balancer Forwarding Rule under a data center.'
|
|
73
|
+
@required_options = [
|
|
74
|
+
:datacenter_id, :network_loadbalancer_id, :forwarding_rule_id, :ip, :port, :weight, :ionoscloud_username, :ionoscloud_password,
|
|
75
|
+
]
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def run
|
|
79
|
+
$stdout.sync = true
|
|
80
|
+
validate_required_params(@required_options, config)
|
|
81
|
+
|
|
82
|
+
network_loadbalancers_api = Ionoscloud::NetworkLoadBalancersApi.new(api_client)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
network_load_balancer_rule = network_loadbalancers_api.datacenters_networkloadbalancers_forwardingrules_find_by_forwarding_rule_id(
|
|
86
|
+
config[:datacenter_id], config[:network_loadbalancer_id], config[:forwarding_rule_id],
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
network_loadbalancer_forwarding_rule_target = Ionoscloud::NetworkLoadBalancerForwardingRuleTarget.new(
|
|
90
|
+
ip: config[:ip],
|
|
91
|
+
port: config[:port],
|
|
92
|
+
weight: config[:weight],
|
|
93
|
+
health_check: Ionoscloud::NetworkLoadBalancerForwardingRuleTargetHealthCheck.new(
|
|
94
|
+
check: config[:check],
|
|
95
|
+
check_interval: config[:check_interval],
|
|
96
|
+
maintenance: config[:maintenance],
|
|
97
|
+
),
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
network_load_balancer_rule.properties.targets << network_loadbalancer_forwarding_rule_target
|
|
101
|
+
|
|
102
|
+
_, _, headers = network_loadbalancers_api.datacenters_networkloadbalancers_forwardingrules_patch_with_http_info(
|
|
103
|
+
config[:datacenter_id],
|
|
104
|
+
config[:network_loadbalancer_id],
|
|
105
|
+
config[:forwarding_rule_id],
|
|
106
|
+
Ionoscloud::NetworkLoadBalancerForwardingRuleProperties.new({
|
|
107
|
+
targets: network_load_balancer_rule.properties.targets,
|
|
108
|
+
}),
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
print "#{ui.color('Adding the target to the Network Loadbalancer Forwarding Rule...', :magenta)}"
|
|
112
|
+
dot = ui.color('.', :magenta)
|
|
113
|
+
api_client.wait_for { print dot; is_done? get_request_id headers }
|
|
114
|
+
|
|
115
|
+
network_load_balancer_rule = network_loadbalancers_api.datacenters_networkloadbalancers_forwardingrules_find_by_forwarding_rule_id(
|
|
116
|
+
config[:datacenter_id], config[:network_loadbalancer_id], config[:forwarding_rule_id], depth: 2,
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
puts "\n"
|
|
120
|
+
puts "#{ui.color('ID', :cyan)}: #{network_load_balancer_rule.id}"
|
|
121
|
+
puts "#{ui.color('Name', :cyan)}: #{network_load_balancer_rule.properties.name}"
|
|
122
|
+
puts "#{ui.color('Algorithm', :cyan)}: #{network_load_balancer_rule.properties.algorithm}"
|
|
123
|
+
puts "#{ui.color('Protocol', :cyan)}: #{network_load_balancer_rule.properties.protocol}"
|
|
124
|
+
puts "#{ui.color('Listener IP', :cyan)}: #{network_load_balancer_rule.properties.listener_ip}"
|
|
125
|
+
puts "#{ui.color('Listener Port', :cyan)}: #{network_load_balancer_rule.properties.listener_port}"
|
|
126
|
+
puts "#{ui.color('Health Check', :cyan)}: #{network_load_balancer_rule.properties.health_check}"
|
|
127
|
+
puts "#{ui.color('Targets', :cyan)}: #{network_load_balancer_rule.properties.targets.map do |target|
|
|
128
|
+
{
|
|
129
|
+
ip: target.ip,
|
|
130
|
+
port: target.port,
|
|
131
|
+
weight: target.weight,
|
|
132
|
+
check: target.health_check.check,
|
|
133
|
+
check_interval: target.health_check.check_interval,
|
|
134
|
+
maintenance: target.health_check.maintenance,
|
|
135
|
+
}
|
|
136
|
+
end}"
|
|
137
|
+
puts 'done'
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
end
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
require_relative 'ionoscloud_base'
|
|
2
|
+
|
|
3
|
+
class Chef
|
|
4
|
+
class Knife
|
|
5
|
+
class IonoscloudNetworkloadbalancerRuleTargetList < Knife
|
|
6
|
+
include Knife::IonoscloudBase
|
|
7
|
+
|
|
8
|
+
banner 'knife ionoscloud networkloadbalancer rule target 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
|
+
option :forwarding_rule_id,
|
|
21
|
+
short: '-R FORWARDING_RULE_ID',
|
|
22
|
+
long: '--forwarding-rule FORWARDING_RULE_ID',
|
|
23
|
+
description: 'ID of the Network Loadbalancer Forwarding Rule'
|
|
24
|
+
|
|
25
|
+
attr_reader :description, :required_options
|
|
26
|
+
|
|
27
|
+
def initialize(args = [])
|
|
28
|
+
super(args)
|
|
29
|
+
@description =
|
|
30
|
+
'Lists all targets of a Network Loadbalancer Forwarding Rule under a data center.'
|
|
31
|
+
@required_options = [
|
|
32
|
+
:datacenter_id, :network_loadbalancer_id, :forwarding_rule_id, :ionoscloud_username, :ionoscloud_password,
|
|
33
|
+
]
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def run
|
|
37
|
+
$stdout.sync = true
|
|
38
|
+
validate_required_params(@required_options, config)
|
|
39
|
+
|
|
40
|
+
$stdout.sync = true
|
|
41
|
+
target_list = [
|
|
42
|
+
ui.color('IP', :bold),
|
|
43
|
+
ui.color('Port', :bold),
|
|
44
|
+
ui.color('Weight', :bold),
|
|
45
|
+
ui.color('Check', :bold),
|
|
46
|
+
ui.color('Check interval', :bold),
|
|
47
|
+
ui.color('Maintenance', :bold),
|
|
48
|
+
]
|
|
49
|
+
network_loadbalancers_api = Ionoscloud::NetworkLoadBalancersApi.new(api_client)
|
|
50
|
+
|
|
51
|
+
network_load_balancer_rule = network_loadbalancers_api.datacenters_networkloadbalancers_forwardingrules_find_by_forwarding_rule_id(
|
|
52
|
+
config[:datacenter_id], config[:network_loadbalancer_id], config[:forwarding_rule_id],
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
network_load_balancer_rule.properties.targets.each do |target|
|
|
56
|
+
target_list << target.ip
|
|
57
|
+
target_list << target.port
|
|
58
|
+
target_list << target.weight
|
|
59
|
+
target_list << target.health_check.check
|
|
60
|
+
target_list << target.health_check.check_interval
|
|
61
|
+
target_list << target.health_check.maintenance
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
puts ui.list(target_list, :uneven_columns_across, 6)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
require_relative 'ionoscloud_base'
|
|
2
|
+
|
|
3
|
+
class Chef
|
|
4
|
+
class Knife
|
|
5
|
+
class IonoscloudNetworkloadbalancerRuleTargetRemove < Knife
|
|
6
|
+
include Knife::IonoscloudBase
|
|
7
|
+
|
|
8
|
+
banner 'knife ionoscloud networkloadbalancer rule target remove (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 :forwarding_rule_id,
|
|
21
|
+
short: '-R FORWARDING_RULE_ID',
|
|
22
|
+
long: '--forwarding-rule FORWARDING_RULE_ID',
|
|
23
|
+
description: 'ID of the Network Loadbalancer Forwarding Rule'
|
|
24
|
+
|
|
25
|
+
option :ip,
|
|
26
|
+
short: '-i IP',
|
|
27
|
+
long: '--ip IP',
|
|
28
|
+
description: 'IP of a balanced target VM'
|
|
29
|
+
|
|
30
|
+
option :port,
|
|
31
|
+
short: '-p PORT',
|
|
32
|
+
long: '--port PORT',
|
|
33
|
+
description: 'Port of the balanced target service. (range: 1 to 65535)'
|
|
34
|
+
|
|
35
|
+
attr_reader :description, :required_options
|
|
36
|
+
|
|
37
|
+
def initialize(args = [])
|
|
38
|
+
super(args)
|
|
39
|
+
@description =
|
|
40
|
+
'Adds a target to a Network Load Balancer Forwarding Rule under a data center.'
|
|
41
|
+
@required_options = [
|
|
42
|
+
:datacenter_id, :network_loadbalancer_id, :forwarding_rule_id, :ip, :port, :ionoscloud_username, :ionoscloud_password,
|
|
43
|
+
]
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def run
|
|
47
|
+
$stdout.sync = true
|
|
48
|
+
validate_required_params(@required_options, config)
|
|
49
|
+
|
|
50
|
+
network_loadbalancers_api = Ionoscloud::NetworkLoadBalancersApi.new(api_client)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
network_load_balancer_rule = network_loadbalancers_api.datacenters_networkloadbalancers_forwardingrules_find_by_forwarding_rule_id(
|
|
54
|
+
config[:datacenter_id], config[:network_loadbalancer_id], config[:forwarding_rule_id],
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
initial_length = network_load_balancer_rule.properties.targets.length
|
|
58
|
+
|
|
59
|
+
network_load_balancer_rule.properties.targets = network_load_balancer_rule.properties.targets.reject do
|
|
60
|
+
|target|
|
|
61
|
+
target.ip == config[:ip] && target.port == Integer(config[:port])
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
if initial_length > network_load_balancer_rule.properties.targets.length
|
|
65
|
+
_, _, headers = network_loadbalancers_api.datacenters_networkloadbalancers_forwardingrules_patch_with_http_info(
|
|
66
|
+
config[:datacenter_id],
|
|
67
|
+
config[:network_loadbalancer_id],
|
|
68
|
+
config[:forwarding_rule_id],
|
|
69
|
+
Ionoscloud::NetworkLoadBalancerForwardingRuleProperties.new({
|
|
70
|
+
targets: network_load_balancer_rule.properties.targets,
|
|
71
|
+
}),
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
print "#{ui.color('Removing the target from the Network Loadbalancer Forwarding Rule...', :magenta)}"
|
|
75
|
+
dot = ui.color('.', :magenta)
|
|
76
|
+
api_client.wait_for { print dot; is_done? get_request_id headers }
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
network_load_balancer_rule = network_loadbalancers_api.datacenters_networkloadbalancers_forwardingrules_find_by_forwarding_rule_id(
|
|
80
|
+
config[:datacenter_id], config[:network_loadbalancer_id], config[:forwarding_rule_id], depth: 2,
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
puts "\n"
|
|
84
|
+
puts "#{ui.color('ID', :cyan)}: #{network_load_balancer_rule.id}"
|
|
85
|
+
puts "#{ui.color('Name', :cyan)}: #{network_load_balancer_rule.properties.name}"
|
|
86
|
+
puts "#{ui.color('Algorithm', :cyan)}: #{network_load_balancer_rule.properties.algorithm}"
|
|
87
|
+
puts "#{ui.color('Protocol', :cyan)}: #{network_load_balancer_rule.properties.protocol}"
|
|
88
|
+
puts "#{ui.color('Listener IP', :cyan)}: #{network_load_balancer_rule.properties.listener_ip}"
|
|
89
|
+
puts "#{ui.color('Listener Port', :cyan)}: #{network_load_balancer_rule.properties.listener_port}"
|
|
90
|
+
puts "#{ui.color('Health Check', :cyan)}: #{network_load_balancer_rule.properties.health_check}"
|
|
91
|
+
puts "#{ui.color('Targets', :cyan)}: #{network_load_balancer_rule.properties.targets.map do |target|
|
|
92
|
+
{
|
|
93
|
+
ip: target.ip,
|
|
94
|
+
port: target.port,
|
|
95
|
+
weight: target.weight,
|
|
96
|
+
check: target.health_check.check,
|
|
97
|
+
check_interval: target.health_check.check_interval,
|
|
98
|
+
maintenance: target.health_check.maintenance,
|
|
99
|
+
}
|
|
100
|
+
end}"
|
|
101
|
+
puts 'done'
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
@@ -39,9 +39,12 @@ class Chef
|
|
|
39
39
|
long: '--lan ID',
|
|
40
40
|
description: 'The LAN ID the NIC will reside on; if the LAN ID does not exist it will be created'
|
|
41
41
|
|
|
42
|
-
option :
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
option :firewall_type,
|
|
43
|
+
short: '-t FIREWALL_TYPE',
|
|
44
|
+
long: '--firewall-type FIREWALL_TYPE',
|
|
45
|
+
description: 'The type of firewall rules that will be allowed on the NIC. If it is not specified it will take the '\
|
|
46
|
+
'default value INGRESS',
|
|
47
|
+
default: 'INGRESS'
|
|
45
48
|
|
|
46
49
|
attr_reader :description, :required_options
|
|
47
50
|
|
|
@@ -63,20 +66,20 @@ class Chef
|
|
|
63
66
|
config[:ips] = config[:ips].split(',')
|
|
64
67
|
end
|
|
65
68
|
|
|
66
|
-
|
|
69
|
+
nic_properties = {
|
|
67
70
|
name: config[:name],
|
|
68
71
|
ips: config[:ips],
|
|
69
72
|
dhcp: config[:dhcp],
|
|
70
73
|
lan: config[:lan],
|
|
71
|
-
|
|
72
|
-
}
|
|
74
|
+
firewall_type: config[:firewall_type]
|
|
75
|
+
}.compact
|
|
73
76
|
|
|
74
|
-
nic_api = Ionoscloud::
|
|
77
|
+
nic_api = Ionoscloud::NetworkInterfacesApi.new(api_client)
|
|
75
78
|
|
|
76
79
|
nic, _, headers = nic_api.datacenters_servers_nics_post_with_http_info(
|
|
77
80
|
config[:datacenter_id],
|
|
78
81
|
config[:server_id],
|
|
79
|
-
|
|
82
|
+
Ionoscloud::Nic.new(properties: Ionoscloud::NicProperties.new(**nic_properties)),
|
|
80
83
|
)
|
|
81
84
|
|
|
82
85
|
dot = ui.color('.', :magenta)
|
|
@@ -94,7 +97,9 @@ class Chef
|
|
|
94
97
|
puts "#{ui.color('IPs', :cyan)}: #{nic.properties.ips.to_s}"
|
|
95
98
|
puts "#{ui.color('DHCP', :cyan)}: #{nic.properties.dhcp}"
|
|
96
99
|
puts "#{ui.color('LAN', :cyan)}: #{nic.properties.lan}"
|
|
97
|
-
puts "#{ui.color('
|
|
100
|
+
puts "#{ui.color('Firewall Type', :cyan)}: #{nic.properties.firewall_type}"
|
|
101
|
+
puts "#{ui.color('Device Number', :cyan)}: #{nic.properties.device_number}"
|
|
102
|
+
puts "#{ui.color('PCI Slot', :cyan)}: #{nic.properties.pci_slot}"
|
|
98
103
|
|
|
99
104
|
puts 'done'
|
|
100
105
|
end
|