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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 475b719ef44823a6cb5c031100ed1b1eda199b297653f7342bb3076b73dd56b4
|
|
4
|
+
data.tar.gz: 0c662d549b3a8f3ce5144e75f1a7e46eae51c12697f14fb2ebb3758d80a0a37e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bace38ac3687134ca983fad4d3329b8d18c316c2ea6431a3472395b3b6ddbd9bd46e2421a620ac2ab0df85f0282559647833b9aa052b58a137468e73869790f3
|
|
7
|
+
data.tar.gz: d730abe3bdf1950fe11b970d7dc7f964ff140080d12553a0d8447e88f0b19e504da3834324afdd411c5bfa210a69d080f55eb348a6eddf053edee626c2fa8c7f
|
data/knife-ionoscloud.gemspec
CHANGED
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
|
20
20
|
spec.require_paths = ['lib']
|
|
21
21
|
|
|
22
22
|
spec.add_runtime_dependency 'chef', '~> 16.10', '>= 16.10.17'
|
|
23
|
-
spec.add_runtime_dependency 'ionoscloud', '~>
|
|
23
|
+
spec.add_runtime_dependency 'ionoscloud', '~> 6.0.0.beta.3'
|
|
24
24
|
|
|
25
25
|
spec.add_development_dependency 'rspec', '~> 3.10'
|
|
26
26
|
spec.add_development_dependency 'simplecov', '~> 0.21.2'
|
|
@@ -37,7 +37,7 @@ class Chef
|
|
|
37
37
|
|
|
38
38
|
print "#{ui.color('Creating Backup unit...', :magenta)}"
|
|
39
39
|
|
|
40
|
-
backupunit_api = Ionoscloud::
|
|
40
|
+
backupunit_api = Ionoscloud::BackupUnitsApi.new(api_client)
|
|
41
41
|
|
|
42
42
|
backupunit, _, headers = backupunit_api.backupunits_post_with_http_info({
|
|
43
43
|
properties: {
|
|
@@ -23,7 +23,7 @@ class Chef
|
|
|
23
23
|
$stdout.sync = true
|
|
24
24
|
validate_required_params(@required_options, config)
|
|
25
25
|
|
|
26
|
-
backupunit_api = Ionoscloud::
|
|
26
|
+
backupunit_api = Ionoscloud::BackupUnitsApi.new(api_client)
|
|
27
27
|
|
|
28
28
|
@name_args.each do |backupunit_id|
|
|
29
29
|
begin
|
|
@@ -26,7 +26,7 @@ class Chef
|
|
|
26
26
|
ui.color('Email', :bold),
|
|
27
27
|
]
|
|
28
28
|
|
|
29
|
-
backupunit_api = Ionoscloud::
|
|
29
|
+
backupunit_api = Ionoscloud::BackupUnitsApi.new(api_client)
|
|
30
30
|
|
|
31
31
|
backupunit_api.backupunits_get({ depth: 1 }).items.each do |backupunit|
|
|
32
32
|
backupunit_list << backupunit.id
|
|
@@ -28,7 +28,7 @@ class Chef
|
|
|
28
28
|
validate_required_params(@required_options, config)
|
|
29
29
|
|
|
30
30
|
begin
|
|
31
|
-
puts Ionoscloud::
|
|
31
|
+
puts Ionoscloud::BackupUnitsApi.new(api_client).backupunits_ssourl_get(config[:backupunit_id]).sso_url
|
|
32
32
|
rescue Ionoscloud::ApiError => err
|
|
33
33
|
raise err unless err.code == 404
|
|
34
34
|
ui.error("Backup unit ID #{config[:backupunit_id]} not found.")
|
|
@@ -57,7 +57,7 @@ class Chef
|
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
def is_done?(request_id)
|
|
60
|
-
response = Ionoscloud::
|
|
60
|
+
response = Ionoscloud::RequestsApi.new(api_client).requests_status_get(request_id)
|
|
61
61
|
if response.metadata.status == 'FAILED'
|
|
62
62
|
puts "\nRequest #{request_id} failed\n#{response.metadata.message.to_s}"
|
|
63
63
|
exit(1)
|
|
@@ -87,6 +87,20 @@ class Chef
|
|
|
87
87
|
long: '--ssh-keys SSHKEY1,SSHKEY2,...',
|
|
88
88
|
description: 'A list of public SSH keys to include'
|
|
89
89
|
|
|
90
|
+
option :backupunit_id,
|
|
91
|
+
short: '-B BACKUPUNIT_ID',
|
|
92
|
+
long: '--backupunit BACKUPUNIT_ID',
|
|
93
|
+
description: 'The uuid of the Backup Unit that user has access to. The property is immutable and is only allowed '\
|
|
94
|
+
'to be set on a new volume creation. It is mandatory to provide either \'public image\' or \'imageAlias\' in '\
|
|
95
|
+
'conjunction with this property.'
|
|
96
|
+
|
|
97
|
+
option :user_data,
|
|
98
|
+
short: '-u USER_DATA',
|
|
99
|
+
long: '--user-data USER_DATA',
|
|
100
|
+
description: 'The cloud-init configuration for the volume as base64 encoded string. The property is '\
|
|
101
|
+
'immutable and is only allowed to be set on a new volume creation. It is mandatory to provide either \'public image\' '\
|
|
102
|
+
'or \'imageAlias\' that has cloud-init compatibility in conjunction with this property.'
|
|
103
|
+
|
|
90
104
|
option :nic_name,
|
|
91
105
|
long: '--nic-name NAME',
|
|
92
106
|
description: 'Name of the NIC'
|
|
@@ -108,9 +122,11 @@ class Chef
|
|
|
108
122
|
long: '--lan ID',
|
|
109
123
|
description: 'The LAN ID the NIC will reside on; if the LAN ID does not exist it will be created'
|
|
110
124
|
|
|
111
|
-
option :
|
|
112
|
-
long: '--
|
|
113
|
-
description: '
|
|
125
|
+
option :firewall_type,
|
|
126
|
+
long: '--firewall-type FIREWALL_TYPE',
|
|
127
|
+
description: 'The type of firewall rules that will be allowed on the NIC. If it is not specified it will take the '\
|
|
128
|
+
'default value INGRESS',
|
|
129
|
+
default: 'INGRESS'
|
|
114
130
|
|
|
115
131
|
attr_reader :description, :required_options
|
|
116
132
|
|
|
@@ -127,23 +143,8 @@ class Chef
|
|
|
127
143
|
$stdout.sync = true
|
|
128
144
|
validate_required_params(@required_options, config)
|
|
129
145
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
exit(1)
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
if !config[:ssh_keys] && !config[:image_password]
|
|
136
|
-
ui.error('Either \'--image-password\' or \'--ssh-keys\' parameter must be provided')
|
|
137
|
-
exit(1)
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
if config[:ssh_keys]
|
|
141
|
-
config[:ssh_keys] = config[:ssh_keys].split(',')
|
|
142
|
-
end
|
|
143
|
-
|
|
144
|
-
if config[:ips]
|
|
145
|
-
config[:ips] = config[:ips].split(',')
|
|
146
|
-
end
|
|
146
|
+
config[:ssh_keys] = config[:ssh_keys].split(',') if config[:ssh_keys]
|
|
147
|
+
config[:ips] = config[:ips].split(',') if config[:ips]
|
|
147
148
|
|
|
148
149
|
print ui.color('Creating composite server...', :magenta).to_s
|
|
149
150
|
|
|
@@ -159,6 +160,8 @@ class Chef
|
|
|
159
160
|
type: config[:type],
|
|
160
161
|
licence_type: config[:licence_type],
|
|
161
162
|
availability_zone: config[:volume_availability_zone],
|
|
163
|
+
backupunit_id: config[:backupunit_id],
|
|
164
|
+
user_data: config[:user_data],
|
|
162
165
|
}.compact)
|
|
163
166
|
)
|
|
164
167
|
|
|
@@ -168,11 +171,10 @@ class Chef
|
|
|
168
171
|
ips: config[:ips],
|
|
169
172
|
dhcp: config[:dhcp],
|
|
170
173
|
lan: config[:lan],
|
|
171
|
-
|
|
174
|
+
firewall_type: config[:firewall_type],
|
|
172
175
|
}.compact)
|
|
173
176
|
)
|
|
174
177
|
|
|
175
|
-
|
|
176
178
|
server = Ionoscloud::Server.new(
|
|
177
179
|
properties: Ionoscloud::ServerProperties.new({
|
|
178
180
|
name: config[:name],
|
|
@@ -191,7 +193,7 @@ class Chef
|
|
|
191
193
|
),
|
|
192
194
|
)
|
|
193
195
|
|
|
194
|
-
server_api = Ionoscloud::
|
|
196
|
+
server_api = Ionoscloud::ServersApi.new(api_client)
|
|
195
197
|
|
|
196
198
|
server, _, headers = server_api.datacenters_servers_post_with_http_info(config[:datacenter_id], server)
|
|
197
199
|
|
|
@@ -20,30 +20,39 @@ class Chef
|
|
|
20
20
|
$stdout.sync = true
|
|
21
21
|
validate_required_params(@required_options, config)
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
contracts = Ionoscloud::ContractResourcesApi.new(api_client).contracts_get()
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
25
|
+
contracts.items.each do
|
|
26
|
+
|contract|
|
|
27
|
+
puts "#{ui.color('Contract Type', :cyan)}: #{contract.type}"
|
|
28
|
+
puts "#{ui.color('Contract Owner', :cyan)}: #{contract.properties.owner}"
|
|
29
|
+
puts "#{ui.color('Contract Number', :cyan)}: #{contract.properties.contract_number}"
|
|
30
|
+
puts "#{ui.color('Registration Domain', :cyan)}: #{contract.properties.reg_domain}"
|
|
31
|
+
puts "#{ui.color('Status', :cyan)}: #{contract.properties.status}"
|
|
32
|
+
puts "#{ui.color('Cores per contract', :cyan)}: #{contract.properties.resource_limits.cores_per_contract}"
|
|
33
|
+
puts "#{ui.color('Cores per server', :cyan)}: #{contract.properties.resource_limits.cores_per_server}"
|
|
34
|
+
puts "#{ui.color('Cores provisioned', :cyan)}: #{contract.properties.resource_limits.cores_provisioned}"
|
|
35
|
+
puts "#{ui.color('HDD limit per contract', :cyan)}: #{contract.properties.resource_limits.hdd_limit_per_contract}"
|
|
36
|
+
puts "#{ui.color('HDD limit per volume', :cyan)}: #{contract.properties.resource_limits.hdd_limit_per_volume}"
|
|
37
|
+
puts "#{ui.color('HDD volume provisioned', :cyan)}: #{contract.properties.resource_limits.hdd_volume_provisioned}"
|
|
38
|
+
puts "#{ui.color('RAM per contract', :cyan)}: #{contract.properties.resource_limits.ram_per_contract}"
|
|
39
|
+
puts "#{ui.color('RAM per server', :cyan)}: #{contract.properties.resource_limits.ram_per_server}"
|
|
40
|
+
puts "#{ui.color('RAM provisioned', :cyan)}: #{contract.properties.resource_limits.ram_provisioned}"
|
|
41
|
+
puts "#{ui.color('Reservable IPs', :cyan)}: #{contract.properties.resource_limits.reservable_ips}"
|
|
42
|
+
puts "#{ui.color('Reservable IPs in use', :cyan)}: #{contract.properties.resource_limits.reserved_ips_in_use}"
|
|
43
|
+
puts "#{ui.color('Reservable IPs on contract', :cyan)}: #{contract.properties.resource_limits.reserved_ips_on_contract}"
|
|
44
|
+
puts "#{ui.color('SSD limit per contract', :cyan)}: #{contract.properties.resource_limits.ssd_limit_per_contract}"
|
|
45
|
+
puts "#{ui.color('SSD limit per volume', :cyan)}: #{contract.properties.resource_limits.ssd_limit_per_volume}"
|
|
46
|
+
puts "#{ui.color('SSD volume provisioned', :cyan)}: #{contract.properties.resource_limits.ssd_volume_provisioned}"
|
|
47
|
+
puts "#{ui.color('DAS volume provisioned', :cyan)}: #{contract.properties.resource_limits.das_volume_provisioned}"
|
|
48
|
+
puts "#{ui.color('K8s Cluster Limit Total', :cyan)}: #{contract.properties.resource_limits.k8s_cluster_limit_total}"
|
|
49
|
+
puts "#{ui.color('K8s Clusters provisioned', :cyan)}: #{contract.properties.resource_limits.k8s_clusters_provisioned}"
|
|
50
|
+
puts "#{ui.color('NLB total limit', :cyan)}: #{contract.properties.resource_limits.nlb_limit_total}"
|
|
51
|
+
puts "#{ui.color('NLBs provisioned', :cyan)}: #{contract.properties.resource_limits.nlb_provisioned}"
|
|
52
|
+
puts "#{ui.color('NAT gateway total limit', :cyan)}: #{contract.properties.resource_limits.nat_gateway_limit_total}"
|
|
53
|
+
puts "#{ui.color('NAT gateways provisioned', :cyan)}: #{contract.properties.resource_limits.nat_gateway_provisioned}"
|
|
54
|
+
puts "\n"
|
|
55
|
+
end
|
|
47
56
|
end
|
|
48
57
|
end
|
|
49
58
|
end
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
require_relative 'ionoscloud_base'
|
|
2
|
+
|
|
3
|
+
class Chef
|
|
4
|
+
class Knife
|
|
5
|
+
class IonoscloudCubeServerCreate < Knife
|
|
6
|
+
include Knife::IonoscloudBase
|
|
7
|
+
|
|
8
|
+
banner 'knife ionoscloud cube server create (options)'
|
|
9
|
+
|
|
10
|
+
option :datacenter_id,
|
|
11
|
+
short: '-D DATACENTER_ID',
|
|
12
|
+
long: '--datacenter-id DATACENTER_ID',
|
|
13
|
+
description: 'Name of the virtual datacenter'
|
|
14
|
+
|
|
15
|
+
option :name,
|
|
16
|
+
short: '-n NAME',
|
|
17
|
+
long: '--name NAME',
|
|
18
|
+
description: '(required) Name of the server'
|
|
19
|
+
|
|
20
|
+
option :template,
|
|
21
|
+
long: '--template TEMPLATE_UUID',
|
|
22
|
+
description: 'The UUID of the template for creating a CUBE server; the available templates for CUBE servers can be found on the templates resource'
|
|
23
|
+
|
|
24
|
+
option :cpu_family,
|
|
25
|
+
short: '-f CPU_FAMILY',
|
|
26
|
+
long: '--cpu-family CPU_FAMILY',
|
|
27
|
+
description: 'The family of processor cores (INTEL_XEON or AMD_OPTERON)',
|
|
28
|
+
default: 'INTEL_SKYLAKE'
|
|
29
|
+
|
|
30
|
+
option :availability_zone,
|
|
31
|
+
short: '-a AVAILABILITY_ZONE',
|
|
32
|
+
long: '--availability-zone AVAILABILITY_ZONE',
|
|
33
|
+
description: 'The availability zone of the server',
|
|
34
|
+
default: 'AUTO'
|
|
35
|
+
|
|
36
|
+
option :volume_name,
|
|
37
|
+
long: '--volume-name NAME',
|
|
38
|
+
description: 'Name of the volume'
|
|
39
|
+
|
|
40
|
+
option :bus,
|
|
41
|
+
short: '-b BUS',
|
|
42
|
+
long: '--bus BUS',
|
|
43
|
+
description: 'The bus type of the volume (VIRTIO or IDE)'
|
|
44
|
+
|
|
45
|
+
option :image,
|
|
46
|
+
short: '-N ID',
|
|
47
|
+
long: '--image ID',
|
|
48
|
+
description: '(required) The image or snapshot ID'
|
|
49
|
+
|
|
50
|
+
option :licence_type,
|
|
51
|
+
short: '-l LICENCE',
|
|
52
|
+
long: '--licence-type LICENCE',
|
|
53
|
+
description: 'The licence type of the volume (LINUX, WINDOWS, WINDOWS2016, UNKNOWN, OTHER)'
|
|
54
|
+
|
|
55
|
+
option :image_password,
|
|
56
|
+
short: '-P PASSWORD',
|
|
57
|
+
long: '--image-password PASSWORD',
|
|
58
|
+
description: 'The password set on the image for the "root" or "Administrator" user'
|
|
59
|
+
|
|
60
|
+
option :ssh_keys,
|
|
61
|
+
short: '-K SSHKEY[,SSHKEY,...]',
|
|
62
|
+
long: '--ssh-keys SSHKEY1,SSHKEY2,...',
|
|
63
|
+
description: 'A list of public SSH keys to include'
|
|
64
|
+
|
|
65
|
+
option :backupunit_id,
|
|
66
|
+
short: '-B BACKUPUNIT_ID',
|
|
67
|
+
long: '--backupunit BACKUPUNIT_ID',
|
|
68
|
+
description: 'The uuid of the Backup Unit that user has access to. The property is immutable and is only allowed '\
|
|
69
|
+
'to be set on a new volume creation. It is mandatory to provide either \'public image\' or \'imageAlias\' in '\
|
|
70
|
+
'conjunction with this property.'
|
|
71
|
+
|
|
72
|
+
option :user_data,
|
|
73
|
+
short: '-u USER_DATA',
|
|
74
|
+
long: '--user-data USER_DATA',
|
|
75
|
+
description: 'The cloud-init configuration for the volume as base64 encoded string. The property is '\
|
|
76
|
+
'immutable and is only allowed to be set on a new volume creation. It is mandatory to provide either \'public image\' '\
|
|
77
|
+
'or \'imageAlias\' that has cloud-init compatibility in conjunction with this property.'
|
|
78
|
+
|
|
79
|
+
option :set_boot,
|
|
80
|
+
long: '--set-boot',
|
|
81
|
+
description: 'Whether to set the volume as the boot volume'
|
|
82
|
+
|
|
83
|
+
option :nic_name,
|
|
84
|
+
long: '--nic-name NAME',
|
|
85
|
+
description: 'Name of the NIC'
|
|
86
|
+
|
|
87
|
+
option :ips,
|
|
88
|
+
short: '-i IP[,IP,...]',
|
|
89
|
+
long: '--ips IP[,IP,...]',
|
|
90
|
+
description: 'IPs assigned to the NIC'
|
|
91
|
+
|
|
92
|
+
option :dhcp,
|
|
93
|
+
short: '-h',
|
|
94
|
+
long: '--dhcp',
|
|
95
|
+
boolean: true | false,
|
|
96
|
+
default: true,
|
|
97
|
+
description: 'Set to false if you wish to disable DHCP'
|
|
98
|
+
|
|
99
|
+
option :lan,
|
|
100
|
+
short: '-L ID',
|
|
101
|
+
long: '--lan ID',
|
|
102
|
+
description: 'The LAN ID the NIC will reside on; if the LAN ID does not exist it will be created'
|
|
103
|
+
|
|
104
|
+
option :firewall_type,
|
|
105
|
+
short: '-t FIREWALL_TYPE',
|
|
106
|
+
long: '--firewall-type FIREWALL_TYPE',
|
|
107
|
+
description: 'The type of firewall rules that will be allowed on the NIC. If it is not specified it will take the '\
|
|
108
|
+
'default value INGRESS',
|
|
109
|
+
default: 'INGRESS'
|
|
110
|
+
|
|
111
|
+
attr_reader :description, :required_options
|
|
112
|
+
|
|
113
|
+
def initialize(args = [])
|
|
114
|
+
super(args)
|
|
115
|
+
@description =
|
|
116
|
+
'This creates a new cube server with an attached volume and NIC in a specified virtual data center.'
|
|
117
|
+
@required_options = [
|
|
118
|
+
:datacenter_id, :name, :template, :ionoscloud_username, :ionoscloud_password,
|
|
119
|
+
]
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def run
|
|
123
|
+
$stdout.sync = true
|
|
124
|
+
validate_required_params(@required_options, config)
|
|
125
|
+
|
|
126
|
+
config[:ssh_keys] = config[:ssh_keys].split(',') if config[:ssh_keys]
|
|
127
|
+
config[:ips] = config[:ips].split(',') if config[:ips]
|
|
128
|
+
|
|
129
|
+
print ui.color('Creating cube server...', :magenta).to_s
|
|
130
|
+
|
|
131
|
+
volumes = [Ionoscloud::Volume.new(
|
|
132
|
+
properties: Ionoscloud::VolumeProperties.new({
|
|
133
|
+
name: config[:volume_name],
|
|
134
|
+
bus: config[:bus] || 'VIRTIO',
|
|
135
|
+
image: config[:image],
|
|
136
|
+
ssh_keys: config[:ssh_keys],
|
|
137
|
+
image_password: config[:image_password],
|
|
138
|
+
type: 'DAS',
|
|
139
|
+
licence_type: config[:licence_type],
|
|
140
|
+
backupunit_id: config[:backupunit_id],
|
|
141
|
+
user_data: config[:user_data],
|
|
142
|
+
}.compact)
|
|
143
|
+
)]
|
|
144
|
+
|
|
145
|
+
nics = []
|
|
146
|
+
|
|
147
|
+
if config[:nic_name] || config[:ips] || config[:dhcp] || config[:lan]
|
|
148
|
+
nics = [
|
|
149
|
+
Ionoscloud::Nic.new(
|
|
150
|
+
properties: Ionoscloud::NicProperties.new({
|
|
151
|
+
name: config[:nic_name],
|
|
152
|
+
ips: config[:ips],
|
|
153
|
+
dhcp: config[:dhcp],
|
|
154
|
+
lan: config[:lan],
|
|
155
|
+
firewall_type: config[:firewall_type],
|
|
156
|
+
}.compact)
|
|
157
|
+
)
|
|
158
|
+
]
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
server = Ionoscloud::Server.new(
|
|
162
|
+
properties: Ionoscloud::ServerProperties.new({
|
|
163
|
+
name: config[:name],
|
|
164
|
+
type: 'CUBE',
|
|
165
|
+
template_uuid: config[:template],
|
|
166
|
+
cpu_family: config[:cpu_family],
|
|
167
|
+
ram: config[:ram],
|
|
168
|
+
availability_zone: config[:availability_zone],
|
|
169
|
+
}.compact),
|
|
170
|
+
entities: Ionoscloud::ServerEntities.new(
|
|
171
|
+
volumes: {
|
|
172
|
+
items: volumes,
|
|
173
|
+
},
|
|
174
|
+
nics: {
|
|
175
|
+
items: nics,
|
|
176
|
+
},
|
|
177
|
+
),
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
server_api = Ionoscloud::ServersApi.new(api_client)
|
|
181
|
+
|
|
182
|
+
server, _, headers = server_api.datacenters_servers_post_with_http_info(config[:datacenter_id], server)
|
|
183
|
+
|
|
184
|
+
dot = ui.color('.', :magenta)
|
|
185
|
+
api_client.wait_for { print dot; is_done? get_request_id headers }
|
|
186
|
+
|
|
187
|
+
server = server_api.datacenters_servers_find_by_id(config[:datacenter_id], server.id, depth: 1)
|
|
188
|
+
|
|
189
|
+
if config[:set_boot]
|
|
190
|
+
changes = Ionoscloud::ServerProperties.new(boot_volume: { id: server.entities.volumes.items[0].id })
|
|
191
|
+
_, _, headers = server_api.datacenters_servers_patch_with_http_info(
|
|
192
|
+
config[:datacenter_id], server.id, changes,
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
api_client.wait_for { is_done? get_request_id headers }
|
|
196
|
+
|
|
197
|
+
server = server_api.datacenters_servers_find_by_id(config[:datacenter_id], server.id, depth: 1)
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
puts "\n"
|
|
201
|
+
puts "#{ui.color('ID', :cyan)}: #{server.id}"
|
|
202
|
+
puts "#{ui.color('Name', :cyan)}: #{server.properties.name}"
|
|
203
|
+
puts "#{ui.color('Type', :cyan)}: #{server.properties.type}"
|
|
204
|
+
puts "#{ui.color('Cores', :cyan)}: #{server.properties.cores}"
|
|
205
|
+
puts "#{ui.color('CPU Family', :cyan)}: #{server.properties.cpu_family}"
|
|
206
|
+
puts "#{ui.color('Ram', :cyan)}: #{server.properties.ram}"
|
|
207
|
+
puts "#{ui.color('Availability Zone', :cyan)}: #{server.properties.availability_zone}"
|
|
208
|
+
puts "#{ui.color('Boot Volume', :cyan)}: #{server.properties.boot_volume ? server.properties.boot_volume.id : ''}"
|
|
209
|
+
puts "#{ui.color('Boot CDROM', :cyan)}: #{server.properties.boot_cdrom ? server.properties.boot_cdrom.id : ''}"
|
|
210
|
+
|
|
211
|
+
puts 'done'
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
end
|
|
@@ -41,7 +41,7 @@ class Chef
|
|
|
41
41
|
|
|
42
42
|
print "#{ui.color('Creating data center...', :magenta)}"
|
|
43
43
|
|
|
44
|
-
datacenter_api = Ionoscloud::
|
|
44
|
+
datacenter_api = Ionoscloud::DataCentersApi.new(api_client)
|
|
45
45
|
|
|
46
46
|
datacenter, _, headers = datacenter_api.datacenters_post_with_http_info({
|
|
47
47
|
properties: {
|