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,70 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ionoscloud_user_get'
|
3
|
+
|
4
|
+
Chef::Knife::IonoscloudUserGet.load_deps
|
5
|
+
|
6
|
+
describe Chef::Knife::IonoscloudUserGet do
|
7
|
+
before :each do
|
8
|
+
subject { Chef::Knife::IonoscloudUserGet.new }
|
9
|
+
|
10
|
+
allow(subject).to receive(:puts)
|
11
|
+
allow(subject).to receive(:print)
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#run' do
|
15
|
+
it 'should call UserApi.users_find_by_id' do
|
16
|
+
user = user_mock
|
17
|
+
subject_config = {
|
18
|
+
ionoscloud_username: 'email',
|
19
|
+
ionoscloud_password: 'password',
|
20
|
+
user_id: user.id,
|
21
|
+
yes: true,
|
22
|
+
}
|
23
|
+
|
24
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
25
|
+
|
26
|
+
expect(subject).to receive(:puts).with("ID: #{user.id}")
|
27
|
+
expect(subject).to receive(:puts).with("Firstname: #{user.properties.firstname}")
|
28
|
+
expect(subject).to receive(:puts).with("Lastname: #{user.properties.lastname}")
|
29
|
+
expect(subject).to receive(:puts).with("Email: #{user.properties.email}")
|
30
|
+
expect(subject).to receive(:puts).with("Administrator: #{user.properties.administrator}")
|
31
|
+
expect(subject).to receive(:puts).with("Force 2-Factor Auth: #{user.properties.force_sec_auth}")
|
32
|
+
expect(subject).to receive(:puts).with("2-Factor Auth Active: #{user.properties.sec_auth_active}")
|
33
|
+
expect(subject).to receive(:puts).with("Active: #{user.properties.active}")
|
34
|
+
|
35
|
+
expect(subject.api_client).not_to receive(:wait_for)
|
36
|
+
mock_call_api(
|
37
|
+
subject,
|
38
|
+
[
|
39
|
+
{
|
40
|
+
method: 'GET',
|
41
|
+
path: "/um/users/#{subject_config[:user_id]}",
|
42
|
+
operation: :'UserManagementApi.um_users_find_by_id',
|
43
|
+
return_type: 'User',
|
44
|
+
result: user,
|
45
|
+
},
|
46
|
+
],
|
47
|
+
)
|
48
|
+
|
49
|
+
expect { subject.run }.not_to raise_error(Exception)
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'should not make any call if any required option is missing' do
|
53
|
+
required_options = subject.instance_variable_get(:@required_options)
|
54
|
+
|
55
|
+
arrays_without_one_element(required_options).each do |test_case|
|
56
|
+
|
57
|
+
test_case[:array].each { |value| subject.config[value] = 'test' }
|
58
|
+
|
59
|
+
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
60
|
+
expect(subject.api_client).not_to receive(:call_api)
|
61
|
+
|
62
|
+
expect { subject.run }.to raise_error(SystemExit) do |error|
|
63
|
+
expect(error.status).to eq(1)
|
64
|
+
end
|
65
|
+
|
66
|
+
required_options.each { |value| subject.config[value] = nil }
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ionoscloud_user_update'
|
3
|
+
|
4
|
+
Chef::Knife::IonoscloudUserUpdate.load_deps
|
5
|
+
|
6
|
+
describe Chef::Knife::IonoscloudUserUpdate do
|
7
|
+
before :each do
|
8
|
+
subject { Chef::Knife::IonoscloudUserUpdate.new }
|
9
|
+
|
10
|
+
allow(subject).to receive(:puts)
|
11
|
+
allow(subject).to receive(:print)
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#run' do
|
15
|
+
it 'should call UserManagementApi.um_groups_users_put' do
|
16
|
+
user = user_mock
|
17
|
+
subject_config = {
|
18
|
+
ionoscloud_username: 'email',
|
19
|
+
ionoscloud_password: 'password',
|
20
|
+
user_id: user.id,
|
21
|
+
firstname: user.properties.firstname + '_edited',
|
22
|
+
lastname: user.properties.lastname + '_edited',
|
23
|
+
email: user.properties.email + '_edited',
|
24
|
+
administrator: (!user.properties.administrator).to_s,
|
25
|
+
force_sec_auth: (!user.properties.force_sec_auth).to_s,
|
26
|
+
sec_auth_active: (!user.properties.sec_auth_active).to_s,
|
27
|
+
active: (!user.properties.active).to_s,
|
28
|
+
yes: true,
|
29
|
+
}
|
30
|
+
|
31
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
32
|
+
|
33
|
+
expect(subject).to receive(:puts).with("ID: #{user.id}")
|
34
|
+
expect(subject).to receive(:puts).with("Firstname: #{subject_config[:firstname]}")
|
35
|
+
expect(subject).to receive(:puts).with("Lastname: #{subject_config[:lastname]}")
|
36
|
+
expect(subject).to receive(:puts).with("Email: #{subject_config[:email]}")
|
37
|
+
expect(subject).to receive(:puts).with("Administrator: #{subject_config[:administrator]}")
|
38
|
+
expect(subject).to receive(:puts).with("Force 2-Factor Auth: #{subject_config[:force_sec_auth]}")
|
39
|
+
expect(subject).to receive(:puts).with("2-Factor Auth Active: #{subject_config[:sec_auth_active]}")
|
40
|
+
expect(subject).to receive(:puts).with("Active: #{subject_config[:active]}")
|
41
|
+
|
42
|
+
user.properties.firstname = subject_config[:firstname]
|
43
|
+
user.properties.lastname = subject_config[:lastname]
|
44
|
+
user.properties.email = subject_config[:email]
|
45
|
+
user.properties.administrator = subject_config[:administrator].to_s.downcase == 'true'
|
46
|
+
user.properties.force_sec_auth = subject_config[:force_sec_auth].to_s.downcase == 'true'
|
47
|
+
user.properties.sec_auth_active = subject_config[:sec_auth_active].to_s.downcase == 'true'
|
48
|
+
user.properties.active = subject_config[:active].to_s.downcase == 'true'
|
49
|
+
|
50
|
+
mock_wait_for(subject)
|
51
|
+
mock_call_api(
|
52
|
+
subject,
|
53
|
+
[
|
54
|
+
{
|
55
|
+
method: 'GET',
|
56
|
+
path: "/um/users/#{subject_config[:user_id]}",
|
57
|
+
operation: :'UserManagementApi.um_users_find_by_id',
|
58
|
+
return_type: 'User',
|
59
|
+
result: user,
|
60
|
+
},
|
61
|
+
{
|
62
|
+
method: 'PUT',
|
63
|
+
path: "/um/users/#{subject_config[:user_id]}",
|
64
|
+
operation: :'UserManagementApi.um_users_put',
|
65
|
+
return_type: 'User',
|
66
|
+
body: {
|
67
|
+
properties: {
|
68
|
+
firstname: subject_config[:firstname],
|
69
|
+
lastname: subject_config[:lastname],
|
70
|
+
email: subject_config[:email],
|
71
|
+
administrator: subject_config[:administrator].to_s.downcase == 'true',
|
72
|
+
forceSecAuth: subject_config[:force_sec_auth].to_s.downcase == 'true',
|
73
|
+
secAuthActive: subject_config[:sec_auth_active].to_s.downcase == 'true',
|
74
|
+
active: subject_config[:active].to_s.downcase == 'true',
|
75
|
+
},
|
76
|
+
},
|
77
|
+
result: user,
|
78
|
+
},
|
79
|
+
{
|
80
|
+
method: 'GET',
|
81
|
+
path: "/um/users/#{subject_config[:user_id]}",
|
82
|
+
operation: :'UserManagementApi.um_users_find_by_id',
|
83
|
+
return_type: 'User',
|
84
|
+
result: user,
|
85
|
+
},
|
86
|
+
],
|
87
|
+
)
|
88
|
+
|
89
|
+
expect { subject.run }.not_to raise_error(Exception)
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'should not make any call if any required option is missing' do
|
93
|
+
required_options = subject.instance_variable_get(:@required_options)
|
94
|
+
|
95
|
+
arrays_without_one_element(required_options).each do |test_case|
|
96
|
+
|
97
|
+
test_case[:array].each { |value| subject.config[value] = 'test' }
|
98
|
+
|
99
|
+
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
100
|
+
expect(subject.api_client).not_to receive(:call_api)
|
101
|
+
|
102
|
+
expect { subject.run }.to raise_error(SystemExit) do |error|
|
103
|
+
expect(error.status).to eq(1)
|
104
|
+
end
|
105
|
+
|
106
|
+
required_options.each { |value| subject.config[value] = nil }
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
@@ -37,13 +37,23 @@ describe Chef::Knife::IonoscloudVolumeCreate do
|
|
37
37
|
expected_body[:imagePassword] = subject_config[:image_password]
|
38
38
|
|
39
39
|
expect(subject).to receive(:puts).with("ID: #{volume.id}")
|
40
|
-
expect(subject).to receive(:puts).with("Name: #{
|
41
|
-
expect(subject).to receive(:puts).with("Size: #{
|
42
|
-
expect(subject).to receive(:puts).with("Bus: #{
|
40
|
+
expect(subject).to receive(:puts).with("Name: #{volume.properties.name}")
|
41
|
+
expect(subject).to receive(:puts).with("Size: #{volume.properties.size}")
|
42
|
+
expect(subject).to receive(:puts).with("Bus: #{volume.properties.bus}")
|
43
43
|
expect(subject).to receive(:puts).with("Image: #{volume.properties.image}")
|
44
|
-
expect(subject).to receive(:puts).with("Type: #{
|
44
|
+
expect(subject).to receive(:puts).with("Type: #{volume.properties.type}")
|
45
45
|
expect(subject).to receive(:puts).with("Licence Type: #{volume.properties.licence_type}")
|
46
|
-
expect(subject).to receive(:puts).with("
|
46
|
+
expect(subject).to receive(:puts).with("Backupunit ID: #{volume.properties.backupunit_id}")
|
47
|
+
expect(subject).to receive(:puts).with("User Data: #{volume.properties.user_data}")
|
48
|
+
expect(subject).to receive(:puts).with("Zone: #{volume.properties.availability_zone}")
|
49
|
+
expect(subject).to receive(:puts).with("CPU Hot Plug: #{volume.properties.cpu_hot_plug}")
|
50
|
+
expect(subject).to receive(:puts).with("RAM Hot Plug: #{volume.properties.ram_hot_plug}")
|
51
|
+
expect(subject).to receive(:puts).with("NIC Hot Plug: #{volume.properties.nic_hot_plug}")
|
52
|
+
expect(subject).to receive(:puts).with("NIC Hot Unplug: #{volume.properties.nic_hot_unplug}")
|
53
|
+
expect(subject).to receive(:puts).with("Disc Virtio Hot Plug: #{volume.properties.disc_virtio_hot_plug}")
|
54
|
+
expect(subject).to receive(:puts).with("Disc Virtio Hot Unplug: #{volume.properties.disc_virtio_hot_unplug}")
|
55
|
+
expect(subject).to receive(:puts).with("Device number: #{volume.properties.device_number}")
|
56
|
+
expect(subject).to receive(:puts).with("PCI Slot: #{volume.properties.pci_slot}")
|
47
57
|
|
48
58
|
mock_wait_for(subject)
|
49
59
|
mock_call_api(
|
@@ -31,7 +31,17 @@ describe Chef::Knife::IonoscloudVolumeDelete do
|
|
31
31
|
expect(subject).to receive(:puts).with("Image: #{volume.properties.image}")
|
32
32
|
expect(subject).to receive(:puts).with("Type: #{volume.properties.type}")
|
33
33
|
expect(subject).to receive(:puts).with("Licence Type: #{volume.properties.licence_type}")
|
34
|
+
expect(subject).to receive(:puts).with("Backupunit ID: #{volume.properties.backupunit_id}")
|
35
|
+
expect(subject).to receive(:puts).with("User Data: #{volume.properties.user_data}")
|
34
36
|
expect(subject).to receive(:puts).with("Zone: #{volume.properties.availability_zone}")
|
37
|
+
expect(subject).to receive(:puts).with("CPU Hot Plug: #{volume.properties.cpu_hot_plug}")
|
38
|
+
expect(subject).to receive(:puts).with("RAM Hot Plug: #{volume.properties.ram_hot_plug}")
|
39
|
+
expect(subject).to receive(:puts).with("NIC Hot Plug: #{volume.properties.nic_hot_plug}")
|
40
|
+
expect(subject).to receive(:puts).with("NIC Hot Unplug: #{volume.properties.nic_hot_unplug}")
|
41
|
+
expect(subject).to receive(:puts).with("Disc Virtio Hot Plug: #{volume.properties.disc_virtio_hot_plug}")
|
42
|
+
expect(subject).to receive(:puts).with("Disc Virtio Hot Unplug: #{volume.properties.disc_virtio_hot_unplug}")
|
43
|
+
expect(subject).to receive(:puts).with("Device number: #{volume.properties.device_number}")
|
44
|
+
expect(subject).to receive(:puts).with("PCI Slot: #{volume.properties.pci_slot}")
|
35
45
|
expect(subject.ui).to receive(:warn).with("Deleted Volume #{volume.id}. Request ID: ")
|
36
46
|
|
37
47
|
expect(subject).not_to receive(:wait_for)
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ionoscloud_volume_get'
|
3
|
+
|
4
|
+
Chef::Knife::IonoscloudVolumeGet.load_deps
|
5
|
+
|
6
|
+
describe Chef::Knife::IonoscloudVolumeGet do
|
7
|
+
before :each do
|
8
|
+
subject { Chef::Knife::IonoscloudVolumeGet.new }
|
9
|
+
|
10
|
+
allow(subject).to receive(:puts)
|
11
|
+
allow(subject).to receive(:print)
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#run' do
|
15
|
+
it 'should call VolumesApi.datacenters_volumes_find_by_id' do
|
16
|
+
volume = volume_mock
|
17
|
+
subject_config = {
|
18
|
+
ionoscloud_username: 'email',
|
19
|
+
ionoscloud_password: 'password',
|
20
|
+
datacenter_id: 'datacenter_id',
|
21
|
+
volume_id: volume.id,
|
22
|
+
yes: true,
|
23
|
+
}
|
24
|
+
|
25
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
26
|
+
|
27
|
+
expect(subject).to receive(:puts).with("ID: #{volume.id}")
|
28
|
+
expect(subject).to receive(:puts).with("Name: #{volume.properties.name}")
|
29
|
+
expect(subject).to receive(:puts).with("Size: #{volume.properties.size}")
|
30
|
+
expect(subject).to receive(:puts).with("Bus: #{volume.properties.bus}")
|
31
|
+
expect(subject).to receive(:puts).with("Image: #{volume.properties.image}")
|
32
|
+
expect(subject).to receive(:puts).with("Type: #{volume.properties.type}")
|
33
|
+
expect(subject).to receive(:puts).with("Licence Type: #{volume.properties.licence_type}")
|
34
|
+
expect(subject).to receive(:puts).with("Backupunit ID: #{volume.properties.backupunit_id}")
|
35
|
+
expect(subject).to receive(:puts).with("User Data: #{volume.properties.user_data}")
|
36
|
+
expect(subject).to receive(:puts).with("Zone: #{volume.properties.availability_zone}")
|
37
|
+
expect(subject).to receive(:puts).with("CPU Hot Plug: #{volume.properties.cpu_hot_plug}")
|
38
|
+
expect(subject).to receive(:puts).with("RAM Hot Plug: #{volume.properties.ram_hot_plug}")
|
39
|
+
expect(subject).to receive(:puts).with("NIC Hot Plug: #{volume.properties.nic_hot_plug}")
|
40
|
+
expect(subject).to receive(:puts).with("NIC Hot Unplug: #{volume.properties.nic_hot_unplug}")
|
41
|
+
expect(subject).to receive(:puts).with("Disc Virtio Hot Plug: #{volume.properties.disc_virtio_hot_plug}")
|
42
|
+
expect(subject).to receive(:puts).with("Disc Virtio Hot Unplug: #{volume.properties.disc_virtio_hot_unplug}")
|
43
|
+
expect(subject).to receive(:puts).with("Device number: #{volume.properties.device_number}")
|
44
|
+
expect(subject).to receive(:puts).with("PCI Slot: #{volume.properties.pci_slot}")
|
45
|
+
|
46
|
+
expect(subject.api_client).not_to receive(:wait_for)
|
47
|
+
mock_call_api(
|
48
|
+
subject,
|
49
|
+
[
|
50
|
+
{
|
51
|
+
method: 'GET',
|
52
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/volumes/#{subject_config[:volume_id]}",
|
53
|
+
operation: :'VolumesApi.datacenters_volumes_find_by_id',
|
54
|
+
return_type: 'Volume',
|
55
|
+
result: volume,
|
56
|
+
},
|
57
|
+
],
|
58
|
+
)
|
59
|
+
|
60
|
+
expect { subject.run }.not_to raise_error(Exception)
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'should not make any call if any required option is missing' do
|
64
|
+
required_options = subject.instance_variable_get(:@required_options)
|
65
|
+
|
66
|
+
arrays_without_one_element(required_options).each do |test_case|
|
67
|
+
|
68
|
+
test_case[:array].each { |value| subject.config[value] = 'test' }
|
69
|
+
|
70
|
+
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
71
|
+
expect(subject.api_client).not_to receive(:call_api)
|
72
|
+
|
73
|
+
expect { subject.run }.to raise_error(SystemExit) do |error|
|
74
|
+
expect(error.status).to eq(1)
|
75
|
+
end
|
76
|
+
|
77
|
+
required_options.each { |value| subject.config[value] = nil }
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ionoscloud_volume_update'
|
3
|
+
|
4
|
+
Chef::Knife::IonoscloudVolumeUpdate.load_deps
|
5
|
+
|
6
|
+
describe Chef::Knife::IonoscloudVolumeUpdate do
|
7
|
+
before :each do
|
8
|
+
subject { Chef::Knife::IonoscloudVolumeUpdate.new }
|
9
|
+
|
10
|
+
allow(subject).to receive(:puts)
|
11
|
+
allow(subject).to receive(:print)
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#run' do
|
15
|
+
it 'should call VolumesApi.datacenters_volumes_patch' do
|
16
|
+
volume = volume_mock
|
17
|
+
subject_config = {
|
18
|
+
ionoscloud_username: 'email',
|
19
|
+
ionoscloud_password: 'password',
|
20
|
+
datacenter_id: 'datacenter_id',
|
21
|
+
volume_id: volume.id,
|
22
|
+
name: volume.properties.name + '_edited',
|
23
|
+
size: volume.properties.size + 10,
|
24
|
+
bus: 'IDE',
|
25
|
+
cpu_hot_plug: (!volume.properties.cpu_hot_plug).to_s,
|
26
|
+
ram_hot_plug: (!volume.properties.ram_hot_plug).to_s,
|
27
|
+
nic_hot_plug: (!volume.properties.nic_hot_plug).to_s,
|
28
|
+
disc_virtio_hot_plug: (!volume.properties.disc_virtio_hot_plug).to_s,
|
29
|
+
disc_virtio_hot_unplug: (!volume.properties.disc_virtio_hot_unplug).to_s,
|
30
|
+
|
31
|
+
yes: true,
|
32
|
+
}
|
33
|
+
|
34
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
35
|
+
|
36
|
+
expect(subject).to receive(:puts).with("ID: #{volume.id}")
|
37
|
+
expect(subject).to receive(:puts).with("Name: #{subject_config[:name]}")
|
38
|
+
expect(subject).to receive(:puts).with("Size: #{subject_config[:size]}")
|
39
|
+
expect(subject).to receive(:puts).with("Bus: #{subject_config[:bus]}")
|
40
|
+
expect(subject).to receive(:puts).with("Image: #{volume.properties.image}")
|
41
|
+
expect(subject).to receive(:puts).with("Type: #{volume.properties.type}")
|
42
|
+
expect(subject).to receive(:puts).with("Licence Type: #{volume.properties.licence_type}")
|
43
|
+
expect(subject).to receive(:puts).with("Backupunit ID: #{volume.properties.backupunit_id}")
|
44
|
+
expect(subject).to receive(:puts).with("User Data: #{volume.properties.user_data}")
|
45
|
+
expect(subject).to receive(:puts).with("Zone: #{volume.properties.availability_zone}")
|
46
|
+
expect(subject).to receive(:puts).with("CPU Hot Plug: #{subject_config[:cpu_hot_plug]}")
|
47
|
+
expect(subject).to receive(:puts).with("RAM Hot Plug: #{subject_config[:ram_hot_plug]}")
|
48
|
+
expect(subject).to receive(:puts).with("NIC Hot Plug: #{subject_config[:nic_hot_plug]}")
|
49
|
+
expect(subject).to receive(:puts).with("NIC Hot Unplug: #{volume.properties.nic_hot_unplug}")
|
50
|
+
expect(subject).to receive(:puts).with("Disc Virtio Hot Plug: #{subject_config[:disc_virtio_hot_plug]}")
|
51
|
+
expect(subject).to receive(:puts).with("Disc Virtio Hot Unplug: #{subject_config[:disc_virtio_hot_unplug]}")
|
52
|
+
expect(subject).to receive(:puts).with("Device number: #{volume.properties.device_number}")
|
53
|
+
expect(subject).to receive(:puts).with("PCI Slot: #{volume.properties.pci_slot}")
|
54
|
+
|
55
|
+
volume.properties.name = subject_config[:name]
|
56
|
+
volume.properties.size = subject_config[:size]
|
57
|
+
volume.properties.bus = subject_config[:bus]
|
58
|
+
volume.properties.cpu_hot_plug = subject_config[:cpu_hot_plug].to_s.downcase == 'true'
|
59
|
+
volume.properties.ram_hot_plug = subject_config[:ram_hot_plug].to_s.downcase == 'true'
|
60
|
+
volume.properties.nic_hot_plug = subject_config[:nic_hot_plug].to_s.downcase == 'true'
|
61
|
+
volume.properties.disc_virtio_hot_plug = subject_config[:disc_virtio_hot_plug].to_s.downcase == 'true'
|
62
|
+
volume.properties.disc_virtio_hot_unplug = subject_config[:disc_virtio_hot_unplug].to_s.downcase == 'true'
|
63
|
+
|
64
|
+
mock_wait_for(subject)
|
65
|
+
mock_call_api(
|
66
|
+
subject,
|
67
|
+
[
|
68
|
+
{
|
69
|
+
method: 'PATCH',
|
70
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/volumes/#{subject_config[:volume_id]}",
|
71
|
+
operation: :'VolumesApi.datacenters_volumes_patch',
|
72
|
+
return_type: 'Volume',
|
73
|
+
body: {
|
74
|
+
name: subject_config[:name],
|
75
|
+
size: subject_config[:size],
|
76
|
+
bus: subject_config[:bus],
|
77
|
+
cpuHotPlug: subject_config[:cpu_hot_plug].to_s.downcase == 'true',
|
78
|
+
ramHotPlug: subject_config[:ram_hot_plug].to_s.downcase == 'true',
|
79
|
+
nicHotPlug: subject_config[:nic_hot_plug].to_s.downcase == 'true',
|
80
|
+
discVirtioHotPlug: subject_config[:disc_virtio_hot_plug].to_s.downcase == 'true',
|
81
|
+
discVirtioHotUnplug: subject_config[:disc_virtio_hot_unplug].to_s.downcase == 'true',
|
82
|
+
},
|
83
|
+
result: volume,
|
84
|
+
},
|
85
|
+
{
|
86
|
+
method: 'GET',
|
87
|
+
path: "/datacenters/#{subject_config[:datacenter_id]}/volumes/#{subject_config[:volume_id]}",
|
88
|
+
operation: :'VolumesApi.datacenters_volumes_find_by_id',
|
89
|
+
return_type: 'Volume',
|
90
|
+
result: volume,
|
91
|
+
},
|
92
|
+
],
|
93
|
+
)
|
94
|
+
|
95
|
+
expect { subject.run }.not_to raise_error(Exception)
|
96
|
+
end
|
97
|
+
|
98
|
+
it 'should not make any call if any required option is missing' do
|
99
|
+
required_options = subject.instance_variable_get(:@required_options)
|
100
|
+
|
101
|
+
arrays_without_one_element(required_options).each do |test_case|
|
102
|
+
|
103
|
+
test_case[:array].each { |value| subject.config[value] = 'test' }
|
104
|
+
|
105
|
+
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
106
|
+
expect(subject.api_client).not_to receive(:call_api)
|
107
|
+
|
108
|
+
expect { subject.run }.to raise_error(SystemExit) do |error|
|
109
|
+
expect(error.status).to eq(1)
|
110
|
+
end
|
111
|
+
|
112
|
+
required_options.each { |value| subject.config[value] = nil }
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -7,7 +7,6 @@ require 'simplecov'
|
|
7
7
|
RSpec.configure do |config|
|
8
8
|
config.pattern = 'spec/chef/knife/*_spec.rb'
|
9
9
|
end
|
10
|
-
|
11
10
|
SimpleCov.start do
|
12
11
|
add_group 'Commands', 'lib/chef/knife/'
|
13
12
|
add_group 'Spec files', 'spec/chef/knife/'
|
@@ -60,7 +59,7 @@ def ipblock_mock(opts = {})
|
|
60
59
|
name: opts[:name] || 'Test IpBlock',
|
61
60
|
size: opts[:size] || 4,
|
62
61
|
location: opts[:location] || 'de/fra',
|
63
|
-
ips: opts[:ips] || ['
|
62
|
+
ips: opts[:ips] || ['127.106.113.181', '127.106.113.176', '127.106.113.177', '127.106.113.178'],
|
64
63
|
),
|
65
64
|
)
|
66
65
|
end
|
@@ -236,7 +235,7 @@ def nic_mock(opts = {})
|
|
236
235
|
id: opts[:id] || SecureRandom.uuid,
|
237
236
|
properties: Ionoscloud::NicProperties.new(
|
238
237
|
name: opts[:name] || 'nic_name',
|
239
|
-
ips: opts[:ips] || ['
|
238
|
+
ips: opts[:ips] || ['127.1.1.1', '127.1.1.2'],
|
240
239
|
dhcp: opts[:dhcp] || true,
|
241
240
|
firewall_active: opts[:firewall_active] || true,
|
242
241
|
mac: opts[:mac] || '00:0a:95:9d:68:16',
|
@@ -266,8 +265,8 @@ def firewall_mock(opts = {})
|
|
266
265
|
name: opts[:name] || 'firewall_name',
|
267
266
|
protocol: opts[:protocol] || 'UDP',
|
268
267
|
source_mac: opts[:source_mac] || '01:23:45:67:89:00',
|
269
|
-
source_ip: opts[:source_ip] || '
|
270
|
-
target_ip: opts[:target_ip] || '
|
268
|
+
source_ip: opts[:source_ip] || '127.9.20.11',
|
269
|
+
target_ip: opts[:target_ip] || '127.9.20.11',
|
271
270
|
port_range_start: opts[:port_range_start] || 22,
|
272
271
|
port_range_end: opts[:port_range_end] || 22,
|
273
272
|
icmp_type: opts[:icmp_type] || 4,
|
@@ -290,7 +289,7 @@ def load_balancer_mock(opts = {})
|
|
290
289
|
id: opts[:id] || SecureRandom.uuid,
|
291
290
|
properties: Ionoscloud::LoadbalancerProperties.new(
|
292
291
|
name: opts[:name] || 'load_balancer_name',
|
293
|
-
ip: opts[:ip] || '
|
292
|
+
ip: opts[:ip] || '127.1.1.1',
|
294
293
|
dhcp: opts[:dhcp] || true,
|
295
294
|
),
|
296
295
|
entities: Ionoscloud::LoadbalancerEntities.new(
|
@@ -371,6 +370,16 @@ def k8s_cluster_mock(opts = {})
|
|
371
370
|
name: opts[:name] || 'k8s_cluster_name',
|
372
371
|
k8s_version: opts[:k8s_version] || '1.15.4,',
|
373
372
|
maintenance_window: opts[:maintenance_window] || maintenance_window_mock,
|
373
|
+
api_subnet_allow_list: opts[:api_subnet_allow_list] || [
|
374
|
+
"1.2.3.4/32",
|
375
|
+
"2002::1234:abcd:ffff:c0a8:101/64",
|
376
|
+
"1.2.3.4",
|
377
|
+
"2002::1234:abcd:ffff:c0a8:101"
|
378
|
+
],
|
379
|
+
s3_buckets: opts[:s3_buckets] || [
|
380
|
+
Ionoscloud::S3Bucket.new(name: 'test_name1'),
|
381
|
+
Ionoscloud::S3Bucket.new(name: 'test_name2'),
|
382
|
+
],
|
374
383
|
available_upgrade_versions: opts[:available_upgrade_versions] || ['1.16.4', '1.17.7'],
|
375
384
|
viable_node_pool_versions: opts[:viable_node_pool_versions] || ['1.17.7', '1.18.2']
|
376
385
|
),
|
@@ -398,8 +407,8 @@ def nodepool_lan_mock(opts = {})
|
|
398
407
|
dhcp: opts[:dhcp] || false,
|
399
408
|
routes: opts[:routes] || [
|
400
409
|
Ionoscloud::KubernetesNodePoolLanRoutes.new(
|
401
|
-
network: opts[:network] || '
|
402
|
-
gateway_ip: opts[:gateway_ip] || '
|
410
|
+
network: opts[:network] || '127.2.3.4/24',
|
411
|
+
gateway_ip: opts[:gateway_ip] || '127.1.5.16',
|
403
412
|
),
|
404
413
|
],
|
405
414
|
)
|
@@ -422,10 +431,10 @@ def k8s_nodepool_mock(opts = {})
|
|
422
431
|
maintenance_window: opts[:maintenance_window] || maintenance_window_mock,
|
423
432
|
auto_scaling: opts[:auto_scaling] || auto_scaling_mock,
|
424
433
|
lans: opts[:lans] || [nodepool_lan_mock(id: 12), nodepool_lan_mock(id: 15)],
|
425
|
-
|
426
|
-
annotations: opts[:annotations] || nil,
|
427
|
-
public_ips: opts[:public_ips] || ['81.173.1.2', '82.231.2.5', '92.221.2.4'],
|
434
|
+
public_ips: opts[:public_ips] || ['127.173.1.2', '127.231.2.5', '127.221.2.4'],
|
428
435
|
available_upgrade_versions: opts[:available_upgrade_versions] || ['1.16.4', '1.17.7'],
|
436
|
+
labels: opts[:labels] || { "test_labels": "test_labels" },
|
437
|
+
annotations: opts[:annotations] || { "test_annotations": "test_annotations" },
|
429
438
|
),
|
430
439
|
metadata: Ionoscloud::KubernetesNodeMetadata.new(
|
431
440
|
state: 'READY',
|
@@ -446,7 +455,7 @@ def k8s_node_mock(opts = {})
|
|
446
455
|
id: opts[:id] || SecureRandom.uuid,
|
447
456
|
properties: Ionoscloud::KubernetesNodeProperties.new(
|
448
457
|
name: opts[:name] || 'k8s_node_name',
|
449
|
-
public_ip: opts[:public_ip] || '
|
458
|
+
public_ip: opts[:public_ip] || '127.1.1.1',
|
450
459
|
k8s_version: opts[:k8s_version] || '1.17.7',
|
451
460
|
),
|
452
461
|
metadata: Ionoscloud::KubernetesNodeMetadata.new(
|
@@ -651,6 +660,11 @@ def user_mock(opts = {})
|
|
651
660
|
administrator: opts[:administrator] || false,
|
652
661
|
force_sec_auth: opts[:force_sec_auth] || false,
|
653
662
|
),
|
663
|
+
entities: Ionoscloud::UsersEntities.new(
|
664
|
+
groups: Ionoscloud::Groups.new(
|
665
|
+
items: opts[:groups] || []
|
666
|
+
)
|
667
|
+
)
|
654
668
|
)
|
655
669
|
end
|
656
670
|
|
@@ -727,9 +741,9 @@ def natgateway_rule_mock(opts = {})
|
|
727
741
|
name: opts[:name] || 'test',
|
728
742
|
type: opts[:type] || 'test',
|
729
743
|
protocol: opts[:protocol] || 'test',
|
730
|
-
public_ip: opts[:public_ip] || '
|
731
|
-
source_subnet: opts[:source_subnet] || '
|
732
|
-
target_subnet: opts[:target_subnet] || '
|
744
|
+
public_ip: opts[:public_ip] || '127.1.1.1',
|
745
|
+
source_subnet: opts[:source_subnet] || '127.1.1.1/24',
|
746
|
+
target_subnet: opts[:target_subnet] || '127.1.1.1/24',
|
733
747
|
target_port_range: Ionoscloud::TargetPortRange.new(
|
734
748
|
start: opts[:target_port_range_start] || 10,
|
735
749
|
_end: opts[:target_port_range_end] || 20,
|
@@ -749,7 +763,7 @@ end
|
|
749
763
|
def natgateway_lan_mock(opts = {})
|
750
764
|
Ionoscloud::NatGatewayLanProperties.new(
|
751
765
|
id: opts[:lan_id] || 1,
|
752
|
-
gateway_ips: opts[:gateway_ips] || ['
|
766
|
+
gateway_ips: opts[:gateway_ips] || ['127.8.152.227/24', '127.8.152.227/24'],
|
753
767
|
)
|
754
768
|
end
|
755
769
|
|
@@ -758,11 +772,16 @@ def natgateway_mock(opts = {})
|
|
758
772
|
id: opts[:id] || SecureRandom.uuid,
|
759
773
|
properties: Ionoscloud::NatGatewayProperties.new(
|
760
774
|
name: opts[:name] || 'test',
|
761
|
-
public_ips: opts[:ips] || ['
|
775
|
+
public_ips: opts[:ips] || ['127.1.1.1'],
|
762
776
|
lans: opts[:lans] || [natgateway_lan_mock],
|
763
777
|
),
|
764
778
|
entities: Ionoscloud::NatGatewayEntities.new(
|
765
779
|
rules: natgateway_rules_mock || opts[:rules],
|
780
|
+
flowlogs: opts[:flowlogs] || Ionoscloud::FlowLogs.new(
|
781
|
+
id: 'flowlogs',
|
782
|
+
type: 'collection',
|
783
|
+
items: [],
|
784
|
+
),
|
766
785
|
),
|
767
786
|
)
|
768
787
|
end
|
@@ -800,10 +819,10 @@ def network_loadbalancer_mock(opts = {})
|
|
800
819
|
id: opts[:id] || SecureRandom.uuid,
|
801
820
|
properties: Ionoscloud::NetworkLoadBalancerProperties.new({
|
802
821
|
name: opts[:name] || 'network_loadbalancer_name',
|
803
|
-
ips: opts[:ips] || ['
|
822
|
+
ips: opts[:ips] || ['127.123.123.123'],
|
804
823
|
listener_lan: opts[:listener_lan] || 1,
|
805
824
|
target_lan: opts[:target_lan] || 2,
|
806
|
-
lb_private_ips: opts[:lb_private_ips] || ['
|
825
|
+
lb_private_ips: opts[:lb_private_ips] || ['127.12.12.12'],
|
807
826
|
}),
|
808
827
|
entities: Ionoscloud::NetworkLoadBalancerEntities.new({
|
809
828
|
forwardingrules: opts[:rules] || network_loadbalancer_rules_mock,
|
@@ -817,7 +836,7 @@ def network_loadbalancer_mock(opts = {})
|
|
817
836
|
end
|
818
837
|
|
819
838
|
def network_loadbalancers_mock(opts = {})
|
820
|
-
Ionoscloud::
|
839
|
+
Ionoscloud::NetworkLoadBalancers.new(
|
821
840
|
id: 'network_loadbalancers',
|
822
841
|
type: 'collection',
|
823
842
|
items: [network_loadbalancer_mock, network_loadbalancer_mock],
|
@@ -831,11 +850,10 @@ def network_loadbalancer_rule_mock(opts = {})
|
|
831
850
|
name: opts[:name] || 'network_loadbalancer_rule_name',
|
832
851
|
algorithm: opts[:algorithm] || 'ROUND_ROBIN',
|
833
852
|
protocol: opts[:protocol] || 'TCP',
|
834
|
-
listener_ip: opts[:listener_ip] || '
|
853
|
+
listener_ip: opts[:listener_ip] || '127.123.123.123',
|
835
854
|
listener_port: opts[:listener_port] || 123,
|
836
855
|
health_check: Ionoscloud::NetworkLoadBalancerForwardingRuleHealthCheck.new(
|
837
856
|
client_timeout: opts[:client_timeout] || 100,
|
838
|
-
check_timeout: opts[:check_timeout] || 200,
|
839
857
|
connect_timeout: opts[:connect_timeout] || 300,
|
840
858
|
target_timeout: opts[:target_timeout] || 400,
|
841
859
|
retries: opts[:retries] || 3,
|
@@ -855,7 +873,7 @@ end
|
|
855
873
|
|
856
874
|
def network_loadbalancer_rule_target_mock(opts = {})
|
857
875
|
Ionoscloud::NetworkLoadBalancerForwardingRuleTarget.new(
|
858
|
-
ip: opts[:ip] || '
|
876
|
+
ip: opts[:ip] || '127.123.123.123',
|
859
877
|
port: opts[:port] || 3,
|
860
878
|
weight: opts[:weight] || 10,
|
861
879
|
health_check: Ionoscloud::NetworkLoadBalancerForwardingRuleTargetHealthCheck.new(
|