knife-ionoscloud 6.0.0.beta.1 → 6.0.0.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chef/knife/ionoscloud_backupunit_create.rb +10 -14
- data/lib/chef/knife/ionoscloud_backupunit_delete.rb +1 -4
- data/lib/chef/knife/ionoscloud_backupunit_get.rb +33 -0
- data/lib/chef/knife/ionoscloud_backupunit_update.rb +62 -0
- data/lib/chef/knife/ionoscloud_base.rb +308 -0
- data/lib/chef/knife/ionoscloud_cube_server_create.rb +3 -7
- data/lib/chef/knife/ionoscloud_datacenter_create.rb +10 -13
- data/lib/chef/knife/ionoscloud_datacenter_delete.rb +1 -6
- data/lib/chef/knife/ionoscloud_datacenter_get.rb +33 -0
- data/lib/chef/knife/ionoscloud_datacenter_update.rb +67 -0
- data/lib/chef/knife/ionoscloud_firewall_create.rb +7 -19
- data/lib/chef/knife/ionoscloud_firewall_delete.rb +2 -11
- data/lib/chef/knife/ionoscloud_firewall_get.rb +52 -0
- data/lib/chef/knife/ionoscloud_firewall_update.rb +133 -0
- data/lib/chef/knife/ionoscloud_flowlog_create.rb +4 -10
- data/lib/chef/knife/ionoscloud_flowlog_delete.rb +8 -12
- data/lib/chef/knife/ionoscloud_flowlog_get.rb +84 -0
- data/lib/chef/knife/ionoscloud_flowlog_list.rb +2 -2
- data/lib/chef/knife/ionoscloud_flowlog_update.rb +127 -0
- data/lib/chef/knife/ionoscloud_group_create.rb +1 -16
- data/lib/chef/knife/ionoscloud_group_delete.rb +1 -18
- data/lib/chef/knife/ionoscloud_group_get.rb +1 -19
- data/lib/chef/knife/ionoscloud_group_update.rb +131 -0
- data/lib/chef/knife/ionoscloud_group_user_add.rb +1 -18
- data/lib/chef/knife/ionoscloud_group_user_remove.rb +1 -18
- data/lib/chef/knife/ionoscloud_ipblock_create.rb +10 -13
- data/lib/chef/knife/ionoscloud_ipblock_delete.rb +1 -4
- data/lib/chef/knife/ionoscloud_ipblock_get.rb +33 -0
- data/lib/chef/knife/ionoscloud_ipblock_update.rb +57 -0
- data/lib/chef/knife/ionoscloud_k8s_create.rb +27 -35
- data/lib/chef/knife/ionoscloud_k8s_delete.rb +1 -9
- data/lib/chef/knife/ionoscloud_k8s_get.rb +33 -0
- data/lib/chef/knife/ionoscloud_k8s_update.rb +99 -0
- data/lib/chef/knife/ionoscloud_lan_create.rb +5 -13
- data/lib/chef/knife/ionoscloud_lan_delete.rb +2 -3
- data/lib/chef/knife/ionoscloud_lan_get.rb +38 -0
- data/lib/chef/knife/ionoscloud_lan_list.rb +1 -0
- data/lib/chef/knife/ionoscloud_lan_update.rb +76 -0
- data/lib/chef/knife/ionoscloud_loadbalancer_create.rb +3 -13
- data/lib/chef/knife/ionoscloud_loadbalancer_delete.rb +1 -8
- data/lib/chef/knife/ionoscloud_loadbalancer_get.rb +2 -12
- data/lib/chef/knife/ionoscloud_loadbalancer_nic_add.rb +2 -14
- data/lib/chef/knife/ionoscloud_loadbalancer_nic_remove.rb +2 -15
- data/lib/chef/knife/ionoscloud_loadbalancer_update.rb +73 -0
- data/lib/chef/knife/ionoscloud_natgateway_create.rb +4 -14
- data/lib/chef/knife/ionoscloud_natgateway_delete.rb +2 -18
- data/lib/chef/knife/ionoscloud_natgateway_get.rb +42 -0
- data/lib/chef/knife/ionoscloud_natgateway_lan_add.rb +1 -8
- data/lib/chef/knife/ionoscloud_natgateway_lan_remove.rb +1 -8
- data/lib/chef/knife/ionoscloud_natgateway_list.rb +1 -0
- data/lib/chef/knife/ionoscloud_natgateway_rule_add.rb +4 -22
- data/lib/chef/knife/ionoscloud_natgateway_rule_list.rb +1 -0
- data/lib/chef/knife/ionoscloud_natgateway_rule_remove.rb +3 -21
- data/lib/chef/knife/ionoscloud_natgateway_rule_update.rb +116 -0
- data/lib/chef/knife/ionoscloud_natgateway_update.rb +84 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_create.rb +4 -11
- data/lib/chef/knife/ionoscloud_networkloadbalancer_delete.rb +2 -22
- data/lib/chef/knife/ionoscloud_networkloadbalancer_get.rb +42 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_add.rb +25 -35
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_list.rb +1 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_remove.rb +19 -30
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_target_add.rb +4 -22
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_target_list.rb +1 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_target_remove.rb +4 -22
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_update.rb +148 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_update.rb +98 -0
- data/lib/chef/knife/ionoscloud_nic_create.rb +6 -16
- data/lib/chef/knife/ionoscloud_nic_delete.rb +2 -8
- data/lib/chef/knife/ionoscloud_nic_get.rb +49 -0
- data/lib/chef/knife/ionoscloud_nic_update.rb +96 -0
- data/lib/chef/knife/ionoscloud_node_get.rb +49 -0
- data/lib/chef/knife/ionoscloud_nodepool_create.rb +22 -51
- data/lib/chef/knife/ionoscloud_nodepool_delete.rb +1 -32
- data/lib/chef/knife/ionoscloud_nodepool_get.rb +43 -0
- data/lib/chef/knife/ionoscloud_nodepool_lan_add.rb +1 -26
- data/lib/chef/knife/ionoscloud_nodepool_lan_remove.rb +1 -26
- data/lib/chef/knife/ionoscloud_nodepool_update.rb +124 -0
- data/lib/chef/knife/ionoscloud_pcc_create.rb +9 -15
- data/lib/chef/knife/ionoscloud_pcc_delete.rb +1 -9
- data/lib/chef/knife/ionoscloud_pcc_get.rb +33 -0
- data/lib/chef/knife/ionoscloud_pcc_update.rb +63 -0
- data/lib/chef/knife/ionoscloud_request_get.rb +40 -0
- data/lib/chef/knife/ionoscloud_s3key_create.rb +1 -5
- data/lib/chef/knife/ionoscloud_s3key_delete.rb +1 -4
- data/lib/chef/knife/ionoscloud_s3key_get.rb +38 -0
- data/lib/chef/knife/ionoscloud_server_create.rb +12 -24
- data/lib/chef/knife/ionoscloud_server_delete.rb +2 -8
- data/lib/chef/knife/ionoscloud_server_get.rb +43 -0
- data/lib/chef/knife/ionoscloud_server_update.rb +97 -0
- data/lib/chef/knife/ionoscloud_share_create.rb +7 -11
- data/lib/chef/knife/ionoscloud_share_delete.rb +2 -3
- data/lib/chef/knife/ionoscloud_share_get.rb +38 -0
- data/lib/chef/knife/ionoscloud_share_update.rb +70 -0
- data/lib/chef/knife/ionoscloud_snapshot_create.rb +1 -9
- data/lib/chef/knife/ionoscloud_snapshot_delete.rb +1 -6
- data/lib/chef/knife/ionoscloud_snapshot_get.rb +32 -0
- data/lib/chef/knife/ionoscloud_snapshot_restore.rb +1 -12
- data/lib/chef/knife/ionoscloud_snapshot_update.rb +126 -0
- data/lib/chef/knife/ionoscloud_user_create.rb +1 -8
- data/lib/chef/knife/ionoscloud_user_delete.rb +1 -6
- data/lib/chef/knife/ionoscloud_user_get.rb +32 -0
- data/lib/chef/knife/ionoscloud_user_update.rb +92 -0
- data/lib/chef/knife/ionoscloud_volume_create.rb +1 -12
- data/lib/chef/knife/ionoscloud_volume_delete.rb +2 -8
- data/lib/chef/knife/ionoscloud_volume_get.rb +36 -0
- data/lib/chef/knife/ionoscloud_volume_update.rb +106 -0
- data/lib/knife-ionoscloud/version.rb +1 -1
- data/spec/chef/knife/ionoscloud_backupunit_get_spec.rb +65 -0
- data/spec/chef/knife/ionoscloud_backupunit_update_spec.rb +78 -0
- data/spec/chef/knife/ionoscloud_datacenter_create_spec.rb +3 -0
- data/spec/chef/knife/ionoscloud_datacenter_delete_spec.rb +3 -0
- data/spec/chef/knife/ionoscloud_datacenter_get_spec.rb +69 -0
- data/spec/chef/knife/ionoscloud_datacenter_update_spec.rb +82 -0
- data/spec/chef/knife/ionoscloud_firewall_create_spec.rb +1 -1
- data/spec/chef/knife/ionoscloud_firewall_delete_spec.rb +1 -1
- data/spec/chef/knife/ionoscloud_firewall_get_spec.rb +77 -0
- data/spec/chef/knife/ionoscloud_firewall_update_spec.rb +117 -0
- data/spec/chef/knife/ionoscloud_flowlog_create_spec.rb +3 -3
- data/spec/chef/knife/ionoscloud_flowlog_delete_spec.rb +10 -10
- data/spec/chef/knife/ionoscloud_flowlog_get_spec.rb +171 -0
- data/spec/chef/knife/ionoscloud_flowlog_list_spec.rb +3 -3
- data/spec/chef/knife/ionoscloud_flowlog_update_spec.rb +244 -0
- data/spec/chef/knife/ionoscloud_group_create_spec.rb +3 -0
- data/spec/chef/knife/ionoscloud_group_update_spec.rb +121 -0
- data/spec/chef/knife/ionoscloud_group_user_add_spec.rb +6 -0
- data/spec/chef/knife/ionoscloud_group_user_remove_spec.rb +6 -0
- data/spec/chef/knife/ionoscloud_ipblock_get_spec.rb +66 -0
- data/spec/chef/knife/ionoscloud_ipblock_update_spec.rb +79 -0
- data/spec/chef/knife/ionoscloud_ipfailover_add_spec.rb +1 -1
- data/spec/chef/knife/ionoscloud_ipfailover_remove_spec.rb +3 -3
- data/spec/chef/knife/ionoscloud_k8s_create_spec.rb +7 -0
- data/spec/chef/knife/ionoscloud_k8s_delete_spec.rb +16 -11
- data/spec/chef/knife/ionoscloud_k8s_get_spec.rb +72 -0
- data/spec/chef/knife/ionoscloud_k8s_update_spec.rb +114 -0
- data/spec/chef/knife/ionoscloud_lan_create_spec.rb +1 -0
- data/spec/chef/knife/ionoscloud_lan_delete_spec.rb +2 -0
- data/spec/chef/knife/ionoscloud_lan_get_spec.rb +68 -0
- data/spec/chef/knife/ionoscloud_lan_update_spec.rb +87 -0
- data/spec/chef/knife/ionoscloud_loadbalancer_update_spec.rb +89 -0
- data/spec/chef/knife/ionoscloud_natgateway_create_spec.rb +15 -0
- data/spec/chef/knife/ionoscloud_natgateway_get_spec.rb +81 -0
- data/spec/chef/knife/ionoscloud_natgateway_lan_add_spec.rb +15 -0
- data/spec/chef/knife/ionoscloud_natgateway_lan_remove_spec.rb +15 -0
- data/spec/chef/knife/ionoscloud_natgateway_rule_add_spec.rb +1 -0
- data/spec/chef/knife/ionoscloud_natgateway_rule_remove_spec.rb +1 -0
- data/spec/chef/knife/ionoscloud_natgateway_rule_update_spec.rb +121 -0
- data/spec/chef/knife/ionoscloud_natgateway_update_spec.rb +121 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_create_spec.rb +13 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_delete_spec.rb +3 -2
- data/spec/chef/knife/ionoscloud_networkloadbalancer_get_spec.rb +82 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_add_spec.rb +4 -3
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_remove_spec.rb +70 -44
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_target_add_spec.rb +26 -22
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_target_remove_spec.rb +79 -61
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_update_spec.rb +163 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_update_spec.rb +107 -0
- data/spec/chef/knife/ionoscloud_nic_get_spec.rb +72 -0
- data/spec/chef/knife/ionoscloud_nic_update_spec.rb +97 -0
- data/spec/chef/knife/ionoscloud_node_get_spec.rb +70 -0
- data/spec/chef/knife/ionoscloud_nodepool_create_spec.rb +8 -17
- data/spec/chef/knife/ionoscloud_nodepool_delete_spec.rb +14 -0
- data/spec/chef/knife/ionoscloud_nodepool_get_spec.rb +83 -0
- data/spec/chef/knife/ionoscloud_nodepool_lan_add_spec.rb +29 -33
- data/spec/chef/knife/ionoscloud_nodepool_lan_remove.rb +14 -17
- data/spec/chef/knife/ionoscloud_nodepool_update_spec.rb +134 -0
- data/spec/chef/knife/ionoscloud_pcc_create_spec.rb +5 -2
- data/spec/chef/knife/ionoscloud_pcc_delete_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_pcc_get_spec.rb +71 -0
- data/spec/chef/knife/ionoscloud_pcc_update_spec.rb +83 -0
- data/spec/chef/knife/ionoscloud_request_get_spec.rb +69 -0
- data/spec/chef/knife/ionoscloud_s3key_get_spec.rb +66 -0
- data/spec/chef/knife/ionoscloud_server_create_spec.rb +3 -0
- data/spec/chef/knife/ionoscloud_server_delete_spec.rb +3 -0
- data/spec/chef/knife/ionoscloud_server_get_spec.rb +74 -0
- data/spec/chef/knife/ionoscloud_server_update_spec.rb +105 -0
- data/spec/chef/knife/ionoscloud_share_get_spec.rb +66 -0
- data/spec/chef/knife/ionoscloud_share_update_spec.rb +91 -0
- data/spec/chef/knife/ionoscloud_snapshot_create_spec.rb +12 -0
- data/spec/chef/knife/ionoscloud_snapshot_delete_spec.rb +12 -0
- data/spec/chef/knife/ionoscloud_snapshot_get_spec.rb +79 -0
- data/spec/chef/knife/ionoscloud_snapshot_restore_spec.rb +9 -0
- data/spec/chef/knife/ionoscloud_snapshot_update_spec.rb +113 -0
- data/spec/chef/knife/ionoscloud_user_create_spec.rb +3 -1
- data/spec/chef/knife/ionoscloud_user_delete_spec.rb +4 -2
- data/spec/chef/knife/ionoscloud_user_get_spec.rb +70 -0
- data/spec/chef/knife/ionoscloud_user_update_spec.rb +110 -0
- data/spec/chef/knife/ionoscloud_volume_create_spec.rb +15 -5
- data/spec/chef/knife/ionoscloud_volume_delete_spec.rb +10 -0
- data/spec/chef/knife/ionoscloud_volume_get_spec.rb +81 -0
- data/spec/chef/knife/ionoscloud_volume_update_spec.rb +116 -0
- data/spec/spec_helper.rb +41 -23
- metadata +125 -2
@@ -0,0 +1,38 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudLanGet < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud lan get (options)'
|
9
|
+
|
10
|
+
option :datacenter_id,
|
11
|
+
short: '-D DATACENTER_ID',
|
12
|
+
long: '--datacenter-id DATACENTER_ID',
|
13
|
+
description: 'ID of the data center'
|
14
|
+
|
15
|
+
option :lan_id,
|
16
|
+
short: '-L LAN_ID',
|
17
|
+
long: '--lan-id LAN_ID',
|
18
|
+
description: 'ID of the LAN'
|
19
|
+
|
20
|
+
attr_reader :description, :required_options
|
21
|
+
|
22
|
+
def initialize(args = [])
|
23
|
+
super(args)
|
24
|
+
@description =
|
25
|
+
'Retrieves information about a Ionoscloud LAN.'
|
26
|
+
@required_options = [:datacenter_id, :lan_id, :ionoscloud_username, :ionoscloud_password]
|
27
|
+
end
|
28
|
+
|
29
|
+
def run
|
30
|
+
$stdout.sync = true
|
31
|
+
handle_extra_config
|
32
|
+
validate_required_params(@required_options, config)
|
33
|
+
|
34
|
+
print_lan(Ionoscloud::LansApi.new(api_client).datacenters_lans_find_by_id(config[:datacenter_id], config[:lan_id]))
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudLanUpdate < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud lan update (options)'
|
9
|
+
|
10
|
+
option :datacenter_id,
|
11
|
+
short: '-D DATACENTER_ID',
|
12
|
+
long: '--datacenter-id DATACENTER_ID',
|
13
|
+
description: 'ID of the data center'
|
14
|
+
|
15
|
+
option :lan_id,
|
16
|
+
short: '-L LAN_ID',
|
17
|
+
long: '--lan-id LAN_ID',
|
18
|
+
description: 'ID of the LAN'
|
19
|
+
|
20
|
+
option :name,
|
21
|
+
short: '-n NAME',
|
22
|
+
long: '--name NAME',
|
23
|
+
description: 'Name of the server'
|
24
|
+
|
25
|
+
option :public,
|
26
|
+
short: '-p PUBLIC',
|
27
|
+
long: '--public PUBLIC',
|
28
|
+
boolean: true,
|
29
|
+
description: 'Boolean indicating if the LAN faces the public ' \
|
30
|
+
'Internet or not; defaults to false'
|
31
|
+
|
32
|
+
option :pcc,
|
33
|
+
long: '--pcc PCC_ID',
|
34
|
+
description: 'ID of the PCC to connect the LAN to'
|
35
|
+
|
36
|
+
attr_reader :description, :required_options
|
37
|
+
|
38
|
+
def initialize(args = [])
|
39
|
+
super(args)
|
40
|
+
@description =
|
41
|
+
'Updates information about a Ionoscloud LAN.'
|
42
|
+
@required_options = [:datacenter_id, :lan_id, :ionoscloud_username, :ionoscloud_password]
|
43
|
+
@updatable_fields = [:name, :public, :pcc, :description]
|
44
|
+
end
|
45
|
+
|
46
|
+
def run
|
47
|
+
$stdout.sync = true
|
48
|
+
handle_extra_config
|
49
|
+
validate_required_params(@required_options, config)
|
50
|
+
|
51
|
+
lan_api = Ionoscloud::LansApi.new(api_client)
|
52
|
+
|
53
|
+
if @updatable_fields.map { |el| config[el] }.any?
|
54
|
+
print "#{ui.color('Updating LAN...', :magenta)}"
|
55
|
+
|
56
|
+
_, _, headers = lan_api.datacenters_lans_patch_with_http_info(
|
57
|
+
config[:datacenter_id],
|
58
|
+
config[:lan_id],
|
59
|
+
Ionoscloud::LanProperties.new(
|
60
|
+
name: config[:name],
|
61
|
+
public: (config.key?(:public) ? config[:public].to_s.downcase == 'true' : nil),
|
62
|
+
pcc: config[:pcc],
|
63
|
+
),
|
64
|
+
)
|
65
|
+
|
66
|
+
dot = ui.color('.', :magenta)
|
67
|
+
api_client.wait_for { print dot; is_done? get_request_id headers }
|
68
|
+
else
|
69
|
+
ui.warn("Nothing to update, please set one of the attributes #{@updatable_fields}.")
|
70
|
+
end
|
71
|
+
|
72
|
+
print_lan(lan_api.datacenters_lans_find_by_id(config[:datacenter_id], config[:lan_id]))
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -64,25 +64,15 @@ class Chef
|
|
64
64
|
entities: Ionoscloud::LoadbalancerEntities.new(
|
65
65
|
balancednics: Ionoscloud::Nics.new(
|
66
66
|
items: config[:nics],
|
67
|
-
)
|
68
|
-
)
|
67
|
+
),
|
68
|
+
),
|
69
69
|
),
|
70
70
|
)
|
71
71
|
|
72
72
|
dot = ui.color('.', :magenta)
|
73
73
|
api_client.wait_for { print dot; is_done? get_request_id headers }
|
74
74
|
|
75
|
-
|
76
|
-
|
77
|
-
nics = load_balancer.entities.balancednics.items.map { |nic| nic.id }
|
78
|
-
|
79
|
-
puts "\n"
|
80
|
-
puts "#{ui.color('ID', :cyan)}: #{load_balancer.id}"
|
81
|
-
puts "#{ui.color('Name', :cyan)}: #{load_balancer.properties.name}"
|
82
|
-
puts "#{ui.color('IP address', :cyan)}: #{load_balancer.properties.ip}"
|
83
|
-
puts "#{ui.color('DHCP', :cyan)}: #{load_balancer.properties.dhcp}"
|
84
|
-
puts "#{ui.color('Balanced Nics', :cyan)}: #{nics.to_s}"
|
85
|
-
puts 'done'
|
75
|
+
print_load_balancer(load_balancer_api.datacenters_loadbalancers_find_by_id(config[:datacenter_id], load_balancer.id, { depth: 1 }))
|
86
76
|
end
|
87
77
|
end
|
88
78
|
end
|
@@ -41,14 +41,7 @@ class Chef
|
|
41
41
|
next
|
42
42
|
end
|
43
43
|
|
44
|
-
|
45
|
-
|
46
|
-
msg_pair('ID', load_balancer.id)
|
47
|
-
msg_pair('Name', load_balancer.properties.name)
|
48
|
-
msg_pair('IP address', load_balancer.properties.ip)
|
49
|
-
msg_pair('DHCP', load_balancer.properties.dhcp)
|
50
|
-
msg_pair('Balanced Nics', nics.to_s)
|
51
|
-
|
44
|
+
print_load_balancer(load_balancer)
|
52
45
|
puts "\n"
|
53
46
|
|
54
47
|
begin
|
@@ -33,19 +33,9 @@ class Chef
|
|
33
33
|
|
34
34
|
load_balancer_api = Ionoscloud::LoadBalancersApi.new(api_client)
|
35
35
|
|
36
|
-
|
37
|
-
config[:datacenter_id],
|
38
|
-
config[:loadbalancer_id],
|
39
|
-
{ depth: 1 },
|
36
|
+
print_load_balancer(
|
37
|
+
load_balancer_api.datacenters_loadbalancers_find_by_id(config[:datacenter_id], config[:loadbalancer_id], depth: 1),
|
40
38
|
)
|
41
|
-
|
42
|
-
nics = load_balancer.entities.balancednics.items.map! { |el| el.id }
|
43
|
-
|
44
|
-
puts "#{ui.color('ID', :cyan)}: #{load_balancer.id}"
|
45
|
-
puts "#{ui.color('Name', :cyan)}: #{load_balancer.properties.name}"
|
46
|
-
puts "#{ui.color('IP address', :cyan)}: #{load_balancer.properties.ip}"
|
47
|
-
puts "#{ui.color('DHCP', :cyan)}: #{load_balancer.properties.dhcp}"
|
48
|
-
puts "#{ui.color('Balanced Nics', :cyan)}: #{nics.to_s}"
|
49
39
|
end
|
50
40
|
end
|
51
41
|
end
|
@@ -55,21 +55,9 @@ class Chef
|
|
55
55
|
|
56
56
|
request_ids_to_wait.each { |request_id| api_client.wait_for { is_done? request_id } }
|
57
57
|
|
58
|
-
|
59
|
-
config[:datacenter_id],
|
60
|
-
config[:loadbalancer_id],
|
61
|
-
{ depth: 1 },
|
58
|
+
print_load_balancer(
|
59
|
+
load_balancer_api.datacenters_loadbalancers_find_by_id(config[:datacenter_id], config[:loadbalancer_id], depth: 1),
|
62
60
|
)
|
63
|
-
|
64
|
-
nics = load_balancer.entities.balancednics.items.map! { |el| el.id }
|
65
|
-
|
66
|
-
puts "\n"
|
67
|
-
puts "#{ui.color('ID', :cyan)}: #{load_balancer.id}"
|
68
|
-
puts "#{ui.color('Name', :cyan)}: #{load_balancer.properties.name}"
|
69
|
-
puts "#{ui.color('IP address', :cyan)}: #{load_balancer.properties.ip}"
|
70
|
-
puts "#{ui.color('DHCP', :cyan)}: #{load_balancer.properties.dhcp}"
|
71
|
-
puts "#{ui.color('Balanced Nics', :cyan)}: #{nics.to_s}"
|
72
|
-
puts 'done'
|
73
61
|
end
|
74
62
|
end
|
75
63
|
end
|
@@ -51,26 +51,13 @@ class Chef
|
|
51
51
|
ui.error("NIC ID #{nic_id} not found. Skipping.")
|
52
52
|
next
|
53
53
|
end
|
54
|
-
|
55
54
|
end
|
56
55
|
|
57
56
|
request_ids_to_wait.each { |request_id| api_client.wait_for { is_done? request_id } }
|
58
57
|
|
59
|
-
|
60
|
-
config[:datacenter_id],
|
61
|
-
config[:loadbalancer_id],
|
62
|
-
{ depth: 1 },
|
58
|
+
print_load_balancer(
|
59
|
+
load_balancer_api.datacenters_loadbalancers_find_by_id(config[:datacenter_id], config[:loadbalancer_id], depth: 1),
|
63
60
|
)
|
64
|
-
|
65
|
-
nics = load_balancer.entities.balancednics.items.map! { |el| el.id }
|
66
|
-
|
67
|
-
puts "\n\n"
|
68
|
-
puts "#{ui.color('ID', :cyan)}: #{load_balancer.id}"
|
69
|
-
puts "#{ui.color('Name', :cyan)}: #{load_balancer.properties.name}"
|
70
|
-
puts "#{ui.color('IP address', :cyan)}: #{load_balancer.properties.ip}"
|
71
|
-
puts "#{ui.color('DHCP', :cyan)}: #{load_balancer.properties.dhcp}"
|
72
|
-
puts "#{ui.color('Balanced Nics', :cyan)}: #{nics.to_s}"
|
73
|
-
puts 'done'
|
74
61
|
end
|
75
62
|
end
|
76
63
|
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudLoadbalancerUpdate < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud loadbalancer update (options)'
|
9
|
+
|
10
|
+
option :datacenter_id,
|
11
|
+
short: '-D DATACENTER_ID',
|
12
|
+
long: '--datacenter-id DATACENTER_ID',
|
13
|
+
description: 'ID of the data center'
|
14
|
+
|
15
|
+
option :loadbalancer_id,
|
16
|
+
short: '-L LOADBALANCER_ID',
|
17
|
+
long: '--loadbalancer-id LOADBALANCER_ID',
|
18
|
+
description: 'ID of the load balancer'
|
19
|
+
|
20
|
+
option :name,
|
21
|
+
short: '-n NAME',
|
22
|
+
long: '--name NAME',
|
23
|
+
description: 'Name of the load balancer'
|
24
|
+
|
25
|
+
option :ip,
|
26
|
+
long: '--ip IP',
|
27
|
+
description: 'IPv4 address of the load balancer. All attached NICs will inherit this IP.'
|
28
|
+
|
29
|
+
option :dhcp,
|
30
|
+
long: '--dhcp DHCP',
|
31
|
+
description: 'Indicates if the load balancer will reserve an IP using DHCP.'
|
32
|
+
|
33
|
+
attr_reader :description, :required_options
|
34
|
+
|
35
|
+
def initialize(args = [])
|
36
|
+
super(args)
|
37
|
+
@description =
|
38
|
+
'Updates information about a Ionoscloud Load Balancer.'
|
39
|
+
@required_options = [:datacenter_id, :loadbalancer_id, :ionoscloud_username, :ionoscloud_password]
|
40
|
+
@updatable_fields = [:name, :ip, :dhcp]
|
41
|
+
end
|
42
|
+
|
43
|
+
def run
|
44
|
+
$stdout.sync = true
|
45
|
+
handle_extra_config
|
46
|
+
validate_required_params(@required_options, config)
|
47
|
+
|
48
|
+
load_balancer_api = Ionoscloud::LoadBalancersApi.new(api_client)
|
49
|
+
|
50
|
+
if @updatable_fields.map { |el| config[el] }.any?
|
51
|
+
print "#{ui.color('Updating Load Balancer...', :magenta)}"
|
52
|
+
|
53
|
+
_, _, headers = load_balancer_api.datacenters_loadbalancers_patch_with_http_info(
|
54
|
+
config[:datacenter_id],
|
55
|
+
config[:loadbalancer_id],
|
56
|
+
Ionoscloud::LoadbalancerProperties.new(
|
57
|
+
name: config[:name],
|
58
|
+
dhcp: (config.key?(:dhcp) ? config[:dhcp].to_s.downcase == 'true' : nil),
|
59
|
+
ip: config[:ip],
|
60
|
+
),
|
61
|
+
)
|
62
|
+
|
63
|
+
dot = ui.color('.', :magenta)
|
64
|
+
api_client.wait_for { print dot; is_done? get_request_id headers }
|
65
|
+
else
|
66
|
+
ui.warn("Nothing to update, please set one of the attributes #{@updatable_fields}.")
|
67
|
+
end
|
68
|
+
|
69
|
+
print_load_balancer(load_balancer_api.datacenters_loadbalancers_find_by_id(config[:datacenter_id], config[:loadbalancer_id]))
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -15,12 +15,12 @@ class Chef
|
|
15
15
|
option :name,
|
16
16
|
short: '-n NAME',
|
17
17
|
long: '--name NAME',
|
18
|
-
description: 'Name of the
|
18
|
+
description: 'Name of the NAT gateway'
|
19
19
|
|
20
20
|
option :ips,
|
21
21
|
short: '-i IP[,IP,...]',
|
22
22
|
long: '--ips IP[,IP,...]',
|
23
|
-
description: '
|
23
|
+
description: 'Collection of public IP addresses of the NAT gateway. Should be customer reserved IP addresses in that location'
|
24
24
|
|
25
25
|
attr_reader :description, :required_options
|
26
26
|
|
@@ -47,23 +47,13 @@ class Chef
|
|
47
47
|
)
|
48
48
|
)
|
49
49
|
|
50
|
-
natgateway, _, headers = natgateways_api.datacenters_natgateways_post_with_http_info(
|
51
|
-
config[:datacenter_id],
|
52
|
-
natgateway,
|
53
|
-
)
|
50
|
+
natgateway, _, headers = natgateways_api.datacenters_natgateways_post_with_http_info(config[:datacenter_id], natgateway)
|
54
51
|
|
55
52
|
print "#{ui.color('Creating Nat Gateway...', :magenta)}"
|
56
53
|
dot = ui.color('.', :magenta)
|
57
54
|
api_client.wait_for { print dot; is_done? get_request_id headers }
|
58
55
|
|
59
|
-
|
60
|
-
|
61
|
-
puts "\n"
|
62
|
-
puts "#{ui.color('ID', :cyan)}: #{natgateway.id}"
|
63
|
-
puts "#{ui.color('Name', :cyan)}: #{natgateway.properties.name}"
|
64
|
-
puts "#{ui.color('IPS', :cyan)}: #{natgateway.properties.public_ips}"
|
65
|
-
|
66
|
-
puts 'done'
|
56
|
+
print_natgateway(natgateways_api.datacenters_natgateways_find_by_nat_gateway_id(config[:datacenter_id], natgateway.id, depth: 2))
|
67
57
|
end
|
68
58
|
end
|
69
59
|
end
|
@@ -36,24 +36,8 @@ class Chef
|
|
36
36
|
next
|
37
37
|
end
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
msg_pair('IPS', natgateway.properties.public_ips)
|
42
|
-
msg_pair('LANS', natgateway.properties.lans.map { |el| { id: el.id, gateway_ips: el.gateway_ips } })
|
43
|
-
msg_pair('Rules', natgateway.entities.rules.items.map do |el|
|
44
|
-
{
|
45
|
-
id: el.id,
|
46
|
-
name: el.properties.name,
|
47
|
-
type: el.properties.type,
|
48
|
-
protocol: el.properties.protocol,
|
49
|
-
public_ip: el.properties.public_ip,
|
50
|
-
source_subnet: el.properties.source_subnet,
|
51
|
-
target_subnet: el.properties.target_subnet,
|
52
|
-
target_port_range_start: el.properties.target_port_range ? el.properties.target_port_range.start : '',
|
53
|
-
target_port_range_end: el.properties.target_port_range ? el.properties.target_port_range._end : '',
|
54
|
-
}
|
55
|
-
end
|
56
|
-
)
|
39
|
+
print_natgateway(natgateway)
|
40
|
+
puts "\n"
|
57
41
|
|
58
42
|
begin
|
59
43
|
confirm('Do you really want to delete this NAT Gateway')
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudNatgatewayGet < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud natgateway get (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 :natgateway_id,
|
16
|
+
short: '-G NATGATEWAY_ID',
|
17
|
+
long: '--natgateway-id NATGATEWAY_ID',
|
18
|
+
description: 'ID of the NAT Gateway'
|
19
|
+
|
20
|
+
attr_reader :description, :required_options
|
21
|
+
|
22
|
+
def initialize(args = [])
|
23
|
+
super(args)
|
24
|
+
@description =
|
25
|
+
'Retrieves the attributes of a given NAT Gateway.'
|
26
|
+
@required_options = [:datacenter_id, :natgateway_id, :ionoscloud_username, :ionoscloud_password]
|
27
|
+
end
|
28
|
+
|
29
|
+
def run
|
30
|
+
$stdout.sync = true
|
31
|
+
handle_extra_config
|
32
|
+
validate_required_params(@required_options, config)
|
33
|
+
|
34
|
+
natgateways_api = Ionoscloud::NATGatewaysApi.new(api_client)
|
35
|
+
|
36
|
+
print_natgateway(
|
37
|
+
natgateways_api.datacenters_natgateways_find_by_nat_gateway_id(config[:datacenter_id], config[:natgateway_id], depth: 2),
|
38
|
+
)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -67,14 +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
|
-
|
71
|
-
|
72
|
-
puts "\n"
|
73
|
-
puts "#{ui.color('ID', :cyan)}: #{natgateway.id}"
|
74
|
-
puts "#{ui.color('Name', :cyan)}: #{natgateway.properties.name}"
|
75
|
-
puts "#{ui.color('IPS', :cyan)}: #{natgateway.properties.public_ips}"
|
76
|
-
puts "#{ui.color('LANS', :cyan)}: #{natgateway.properties.lans.map { |el| { id: el.id, gateway_ips: el.gateway_ips } }}"
|
77
|
-
puts 'done'
|
70
|
+
print_natgateway(natgateways_api.datacenters_natgateways_find_by_nat_gateway_id(config[:datacenter_id], config[:natgateway_id]))
|
78
71
|
end
|
79
72
|
end
|
80
73
|
end
|
@@ -45,14 +45,7 @@ class Chef
|
|
45
45
|
dot = ui.color('.', :magenta)
|
46
46
|
api_client.wait_for { print dot; is_done? get_request_id headers }
|
47
47
|
|
48
|
-
|
49
|
-
|
50
|
-
puts "\n"
|
51
|
-
puts "#{ui.color('ID', :cyan)}: #{natgateway.id}"
|
52
|
-
puts "#{ui.color('Name', :cyan)}: #{natgateway.properties.name}"
|
53
|
-
puts "#{ui.color('IPS', :cyan)}: #{natgateway.properties.public_ips}"
|
54
|
-
puts "#{ui.color('LANS', :cyan)}: #{natgateway.properties.lans.map { |el| { id: el.id, gateway_ips: el.gateway_ips } }}"
|
55
|
-
puts 'done'
|
48
|
+
print_natgateway(natgateways_api.datacenters_natgateways_find_by_nat_gateway_id(config[:datacenter_id], natgateway.id))
|
56
49
|
end
|
57
50
|
end
|
58
51
|
end
|
@@ -64,7 +64,7 @@ class Chef
|
|
64
64
|
def initialize(args = [])
|
65
65
|
super(args)
|
66
66
|
@description =
|
67
|
-
'Adds a
|
67
|
+
'Adds a Rule to a Nat Gateway under a data center.'
|
68
68
|
@required_options = [:datacenter_id, :natgateway_id, :name, :source_subnet, :public_ip, :ionoscloud_username, :ionoscloud_password]
|
69
69
|
end
|
70
70
|
|
@@ -98,27 +98,9 @@ class Chef
|
|
98
98
|
dot = ui.color('.', :magenta)
|
99
99
|
api_client.wait_for { print dot; is_done? get_request_id headers }
|
100
100
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
puts "#{ui.color('ID', :cyan)}: #{natgateway.id}"
|
105
|
-
puts "#{ui.color('Name', :cyan)}: #{natgateway.properties.name}"
|
106
|
-
puts "#{ui.color('IPS', :cyan)}: #{natgateway.properties.public_ips}"
|
107
|
-
puts "#{ui.color('LANS', :cyan)}: #{natgateway.properties.lans.map { |el| { id: el.id, gateway_ips: el.gateway_ips } }}"
|
108
|
-
puts "#{ui.color('Rules', :cyan)}: #{natgateway.entities.rules.items.map do |el|
|
109
|
-
{
|
110
|
-
id: el.id,
|
111
|
-
name: el.properties.name,
|
112
|
-
type: el.properties.type,
|
113
|
-
protocol: el.properties.protocol,
|
114
|
-
public_ip: el.properties.public_ip,
|
115
|
-
source_subnet: el.properties.source_subnet,
|
116
|
-
target_subnet: el.properties.target_subnet,
|
117
|
-
target_port_range_start: el.properties.target_port_range ? el.properties.target_port_range.start : '',
|
118
|
-
target_port_range_end: el.properties.target_port_range ? el.properties.target_port_range._end : '',
|
119
|
-
}
|
120
|
-
end}"
|
121
|
-
puts 'done'
|
101
|
+
print_natgateway(
|
102
|
+
natgateways_api.datacenters_natgateways_find_by_nat_gateway_id(config[:datacenter_id], config[:natgateway_id], depth: 2),
|
103
|
+
)
|
122
104
|
end
|
123
105
|
end
|
124
106
|
end
|
@@ -46,27 +46,9 @@ class Chef
|
|
46
46
|
|
47
47
|
headers_to_wait.each { |headers| api_client.wait_for { print dot; is_done? get_request_id headers } }
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
puts "#{ui.color('ID', :cyan)}: #{natgateway.id}"
|
53
|
-
puts "#{ui.color('Name', :cyan)}: #{natgateway.properties.name}"
|
54
|
-
puts "#{ui.color('IPS', :cyan)}: #{natgateway.properties.public_ips}"
|
55
|
-
puts "#{ui.color('LANS', :cyan)}: #{natgateway.properties.lans.map { |el| { id: el.id, gateway_ips: el.gateway_ips } }}"
|
56
|
-
puts "#{ui.color('Rules', :cyan)}: #{natgateway.entities.rules.items.map do |el|
|
57
|
-
{
|
58
|
-
id: el.id,
|
59
|
-
name: el.properties.name,
|
60
|
-
type: el.properties.type,
|
61
|
-
protocol: el.properties.protocol,
|
62
|
-
public_ip: el.properties.public_ip,
|
63
|
-
source_subnet: el.properties.source_subnet,
|
64
|
-
target_subnet: el.properties.target_subnet,
|
65
|
-
target_port_range_start: el.properties.target_port_range ? el.properties.target_port_range.start : '',
|
66
|
-
target_port_range_end: el.properties.target_port_range ? el.properties.target_port_range._end : '',
|
67
|
-
}
|
68
|
-
end}"
|
69
|
-
puts 'done'
|
49
|
+
print_natgateway(
|
50
|
+
natgateways_api.datacenters_natgateways_find_by_nat_gateway_id(config[:datacenter_id], config[:natgateway_id], depth: 2),
|
51
|
+
)
|
70
52
|
end
|
71
53
|
end
|
72
54
|
end
|