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
@@ -50,22 +50,18 @@ class Chef
|
|
50
50
|
share, _, headers = user_management_api.um_groups_shares_post_with_http_info(
|
51
51
|
config[:group_id],
|
52
52
|
config[:resource_id],
|
53
|
-
|
54
|
-
properties:
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
53
|
+
Ionoscloud::GroupShare.new(
|
54
|
+
properties: Ionoscloud::GroupShareProperties.new(
|
55
|
+
edit_privilege: config[:edit_privilege],
|
56
|
+
share_privilege: config[:share_privilege],
|
57
|
+
),
|
58
|
+
),
|
59
59
|
)
|
60
60
|
|
61
61
|
dot = ui.color('.', :magenta)
|
62
62
|
api_client.wait_for { print dot; is_done? get_request_id headers }
|
63
63
|
|
64
|
-
|
65
|
-
puts "#{ui.color('ID', :cyan)}: #{share.id}"
|
66
|
-
puts "#{ui.color('Edit Privilege', :cyan)}: #{share.properties.edit_privilege.to_s}"
|
67
|
-
puts "#{ui.color('Share Privilege', :cyan)}: #{share.properties.share_privilege.to_s}"
|
68
|
-
puts 'done'
|
64
|
+
print_share(share)
|
69
65
|
end
|
70
66
|
end
|
71
67
|
end
|
@@ -37,9 +37,8 @@ class Chef
|
|
37
37
|
next
|
38
38
|
end
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
msg_pair('Share Privilege', share.properties.share_privilege.to_s)
|
40
|
+
print_share(share)
|
41
|
+
puts "\n"
|
43
42
|
|
44
43
|
begin
|
45
44
|
confirm('Do you really want to delete this Resource Share')
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudShareGet < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud share get (options)'
|
9
|
+
|
10
|
+
option :group_id,
|
11
|
+
short: '-G GROUP_ID',
|
12
|
+
long: '--group-id GROUP_ID',
|
13
|
+
description: 'ID of the group.'
|
14
|
+
|
15
|
+
option :resource_id,
|
16
|
+
short: '-R RESOURCE_ID',
|
17
|
+
long: '--resource-id RESOURCE_ID',
|
18
|
+
description: 'The ID of the resource.'
|
19
|
+
|
20
|
+
attr_reader :description, :required_options
|
21
|
+
|
22
|
+
def initialize(args = [])
|
23
|
+
super(args)
|
24
|
+
@description =
|
25
|
+
'Retrieves the attributes of a given Group Share.'
|
26
|
+
@required_options = [:group_id, :resource_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_share(Ionoscloud::UserManagementApi.new(api_client).um_groups_shares_find_by_resource_id(config[:group_id], config[:resource_id]))
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudShareUpdate < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud share update (options)'
|
9
|
+
|
10
|
+
option :group_id,
|
11
|
+
short: '-G GROUP_ID',
|
12
|
+
long: '--group-id GROUP_ID',
|
13
|
+
description: 'ID of the group.'
|
14
|
+
|
15
|
+
option :resource_id,
|
16
|
+
short: '-R RESOURCE_ID',
|
17
|
+
long: '--resource-id RESOURCE_ID',
|
18
|
+
description: 'The ID of the resource.'
|
19
|
+
|
20
|
+
option :edit_privilege,
|
21
|
+
long: '--edit EDIT_PRIVILEGE',
|
22
|
+
description: 'The group has permission to edit privileges on this resource.'
|
23
|
+
|
24
|
+
option :share_privilege,
|
25
|
+
short: '-s SHARE_PRIVILEGE',
|
26
|
+
long: '--share SHARE_PRIVILEGE',
|
27
|
+
description: 'The group has permission to share this resource.'
|
28
|
+
|
29
|
+
attr_reader :description, :required_options
|
30
|
+
|
31
|
+
def initialize(args = [])
|
32
|
+
super(args)
|
33
|
+
@description =
|
34
|
+
'Updates information about a Ionoscloud Group Share.'
|
35
|
+
@required_options = [:group_id, :resource_id, :ionoscloud_username, :ionoscloud_password]
|
36
|
+
@updatable_fields = [:edit_privilege, :share_privilege]
|
37
|
+
end
|
38
|
+
|
39
|
+
def run
|
40
|
+
$stdout.sync = true
|
41
|
+
handle_extra_config
|
42
|
+
validate_required_params(@required_options, config)
|
43
|
+
|
44
|
+
user_management_api = Ionoscloud::UserManagementApi.new(api_client)
|
45
|
+
|
46
|
+
if @updatable_fields.map { |el| config[el] }.any?
|
47
|
+
print "#{ui.color('Updating Group Share...', :magenta)}"
|
48
|
+
|
49
|
+
share = user_management_api.um_groups_shares_find_by_resource_id(config[:group_id], config[:resource_id])
|
50
|
+
|
51
|
+
new_share = Ionoscloud::GroupShare.new(
|
52
|
+
properties: Ionoscloud::GroupShareProperties.new(
|
53
|
+
edit_privilege: (config.key?(:edit_privilege) ? config[:edit_privilege].to_s.downcase == 'true' : share.properties.edit_privilege),
|
54
|
+
share_privilege: (config.key?(:share_privilege) ? config[:share_privilege].to_s.downcase == 'true' : share.properties.share_privilege),
|
55
|
+
),
|
56
|
+
)
|
57
|
+
|
58
|
+
_, _, headers = user_management_api.um_groups_shares_put_with_http_info(config[:group_id], config[:resource_id], new_share)
|
59
|
+
|
60
|
+
dot = ui.color('.', :magenta)
|
61
|
+
api_client.wait_for { print dot; is_done? get_request_id headers }
|
62
|
+
else
|
63
|
+
ui.warn("Nothing to update, please set one of the attributes #{@updatable_fields}.")
|
64
|
+
end
|
65
|
+
|
66
|
+
print_share(user_management_api.um_groups_shares_find_by_resource_id(config[:group_id], config[:resource_id]))
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -68,15 +68,7 @@ class Chef
|
|
68
68
|
dot = ui.color('.', :magenta)
|
69
69
|
api_client.wait_for { print dot; is_done? get_request_id headers }
|
70
70
|
|
71
|
-
|
72
|
-
|
73
|
-
puts "\n"
|
74
|
-
puts "#{ui.color('ID', :cyan)}: #{snapshot.id}"
|
75
|
-
puts "#{ui.color('Name', :cyan)}: #{snapshot.properties.name}"
|
76
|
-
puts "#{ui.color('Description', :cyan)}: #{snapshot.properties.description}"
|
77
|
-
puts "#{ui.color('Location', :cyan)}: #{snapshot.properties.location}"
|
78
|
-
puts "#{ui.color('Size', :cyan)}: #{snapshot.properties.size.to_s}"
|
79
|
-
puts 'done'
|
71
|
+
print_snapshot(Ionoscloud::SnapshotsApi.new(api_client).snapshots_find_by_id(snapshot.id))
|
80
72
|
end
|
81
73
|
end
|
82
74
|
end
|
@@ -32,12 +32,7 @@ class Chef
|
|
32
32
|
next
|
33
33
|
end
|
34
34
|
|
35
|
-
|
36
|
-
msg_pair('Name', snapshot.properties.name)
|
37
|
-
msg_pair('Description', snapshot.properties.description)
|
38
|
-
msg_pair('Location', snapshot.properties.location)
|
39
|
-
msg_pair('Size', snapshot.properties.size.to_s)
|
40
|
-
|
35
|
+
print_snapshot(snapshot)
|
41
36
|
puts "\n"
|
42
37
|
|
43
38
|
begin
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudSnapshotGet < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud snapshot get (options)'
|
9
|
+
|
10
|
+
option :snapshot_id,
|
11
|
+
short: '-S SNAPSHOT_ID',
|
12
|
+
long: '--snapshot-id SNAPSHOT_ID',
|
13
|
+
description: 'ID of the group.'
|
14
|
+
|
15
|
+
attr_reader :description, :required_options
|
16
|
+
|
17
|
+
def initialize(args = [])
|
18
|
+
super(args)
|
19
|
+
@description =
|
20
|
+
'Retrieves the attributes of a given Snapshot.'
|
21
|
+
@required_options = [:snapshot_id, :ionoscloud_username, :ionoscloud_password]
|
22
|
+
end
|
23
|
+
|
24
|
+
def run
|
25
|
+
$stdout.sync = true
|
26
|
+
handle_extra_config
|
27
|
+
validate_required_params(@required_options, config)
|
28
|
+
print_snapshot(Ionoscloud::SnapshotsApi.new(api_client).snapshots_find_by_id(config[:snapshot_id]))
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -52,18 +52,7 @@ class Chef
|
|
52
52
|
|
53
53
|
volume_api = Ionoscloud::VolumesApi.new(api_client)
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
puts "\n"
|
58
|
-
puts "#{ui.color('ID', :cyan)}: #{volume.id}"
|
59
|
-
puts "#{ui.color('Name', :cyan)}: #{volume.properties.name}"
|
60
|
-
puts "#{ui.color('Size', :cyan)}: #{volume.properties.size}"
|
61
|
-
puts "#{ui.color('Bus', :cyan)}: #{volume.properties.bus}"
|
62
|
-
puts "#{ui.color('Image', :cyan)}: #{volume.properties.image}"
|
63
|
-
puts "#{ui.color('Type', :cyan)}: #{volume.properties.type}"
|
64
|
-
puts "#{ui.color('Licence Type', :cyan)}: #{volume.properties.licence_type}"
|
65
|
-
puts "#{ui.color('Zone', :cyan)}: #{volume.properties.availability_zone}"
|
66
|
-
puts 'done'
|
55
|
+
print_volume(volume_api.datacenters_volumes_find_by_id(config[:datacenter_id], config[:volume_id]))
|
67
56
|
end
|
68
57
|
end
|
69
58
|
end
|
@@ -0,0 +1,126 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudSnapshotUpdate < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud snapshot update (options)'
|
9
|
+
|
10
|
+
option :snapshot_id,
|
11
|
+
short: '-S SNAPSHOT_ID',
|
12
|
+
long: '--snapshot-id SNAPSHOT_ID',
|
13
|
+
description: 'ID of the Snapshot.'
|
14
|
+
|
15
|
+
option :name,
|
16
|
+
short: '-n NAME',
|
17
|
+
long: '--name NAME',
|
18
|
+
description: 'Name of the server'
|
19
|
+
|
20
|
+
option :description,
|
21
|
+
long: '--description DESCRIPTION',
|
22
|
+
description: 'The number of processor cores'
|
23
|
+
|
24
|
+
option :sec_auth_protection,
|
25
|
+
long: '--sec-auth-protection SEC_AUTH_PROTECTION',
|
26
|
+
description: 'Boolean value representing if the snapshot requires extra protection e.g. two factor protection'
|
27
|
+
|
28
|
+
option :licence_type,
|
29
|
+
short: '-l LICENCE',
|
30
|
+
long: '--licence-type LICENCE',
|
31
|
+
description: 'The licence type of the snapshot (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
32
|
+
|
33
|
+
option :cpu_hot_plug,
|
34
|
+
long: '--cpu-hot-plug CPU_HOT_PLUG',
|
35
|
+
description: 'The licence type of the snapshot (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
36
|
+
|
37
|
+
option :cpu_hot_unplug,
|
38
|
+
long: '--cpu-hot-unplug CPU_HOT_UNPLUG',
|
39
|
+
description: 'The licence type of the snapshot (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
40
|
+
|
41
|
+
option :ram_hot_plug,
|
42
|
+
long: '--ram-hot-plug RAM_HOT_PLUG',
|
43
|
+
description: 'The licence type of the snapshot (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
44
|
+
|
45
|
+
option :ram_hot_unplug,
|
46
|
+
long: '--ram-hot-unplug RAM_HOT_UNPLUG',
|
47
|
+
description: 'The licence type of the snapshot (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
48
|
+
|
49
|
+
option :nic_hot_plug,
|
50
|
+
long: '--nic-hot-plug NIC_HOT_PLUG',
|
51
|
+
description: 'The licence type of the snapshot (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
52
|
+
|
53
|
+
option :nic_hot_unplug,
|
54
|
+
long: '--nic-hot-unplug NIC_HOT_UNPLUG',
|
55
|
+
description: 'The licence type of the snapshot (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
56
|
+
|
57
|
+
option :disc_virtio_hot_plug,
|
58
|
+
long: '--disc-virtio-hot_plug DISC_VIRTIO_HOT_PLUG',
|
59
|
+
description: 'The licence type of the snapshot (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
60
|
+
|
61
|
+
option :disc_virtio_hot_unplug,
|
62
|
+
long: '--disc-virtio-hot_unplug DISC_VIRTIO_HOT_UNPLUG',
|
63
|
+
description: 'The licence type of the snapshot (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
64
|
+
|
65
|
+
option :disc_scsi_hot_plug,
|
66
|
+
long: '--disc-scsi-hot-plug DISC_SCSI_HOT_PLUG',
|
67
|
+
description: 'The licence type of the snapshot (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
68
|
+
|
69
|
+
option :disc_scsi_hot_unplug,
|
70
|
+
long: '--disc-scsi-hot-unplug DISC_SCSI_HOT_UNPLUG',
|
71
|
+
description: 'The licence type of the snapshot (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
72
|
+
|
73
|
+
attr_reader :description, :required_options
|
74
|
+
|
75
|
+
def initialize(args = [])
|
76
|
+
super(args)
|
77
|
+
@description =
|
78
|
+
'Updates information about a Ionoscloud Snapshot.'
|
79
|
+
@required_options = [:snapshot_id, :ionoscloud_username, :ionoscloud_password]
|
80
|
+
@updatable_fields = [
|
81
|
+
:name, :description, :sec_auth_protection, :licence_type, :cpu_hot_plug, :cpu_hot_unplug, :ram_hot_plug, :ram_hot_unplug,
|
82
|
+
:nic_hot_plug, :nic_hot_unplug, :disc_virtio_hot_plug, :disc_virtio_hot_unplug, :disc_scsi_hot_plug, :disc_scsi_hot_unplug,
|
83
|
+
]
|
84
|
+
end
|
85
|
+
|
86
|
+
def run
|
87
|
+
$stdout.sync = true
|
88
|
+
handle_extra_config
|
89
|
+
validate_required_params(@required_options, config)
|
90
|
+
|
91
|
+
server_api = Ionoscloud::SnapshotsApi.new(api_client)
|
92
|
+
|
93
|
+
if @updatable_fields.map { |el| config[el] }.any?
|
94
|
+
print "#{ui.color('Updating Snapshot...', :magenta)}"
|
95
|
+
|
96
|
+
_, _, headers = server_api.snapshots_patch_with_http_info(
|
97
|
+
config[:snapshot_id],
|
98
|
+
Ionoscloud::SnapshotProperties.new(
|
99
|
+
name: config[:name],
|
100
|
+
description: config[:description],
|
101
|
+
sec_auth_protection: (config.key?(:sec_auth_protection) ? config[:sec_auth_protection].to_s.downcase == 'true' : nil),
|
102
|
+
licence_type: config[:licence_type],
|
103
|
+
cpu_hot_plug: (config.key?(:cpu_hot_plug) ? config[:cpu_hot_plug].to_s.downcase == 'true' : nil),
|
104
|
+
cpu_hot_unplug: (config.key?(:cpu_hot_unplug) ? config[:cpu_hot_unplug].to_s.downcase == 'true' : nil),
|
105
|
+
ram_hot_plug: (config.key?(:ram_hot_plug) ? config[:ram_hot_plug].to_s.downcase == 'true' : nil),
|
106
|
+
ram_hot_unplug: (config.key?(:ram_hot_unplug) ? config[:ram_hot_unplug].to_s.downcase == 'true' : nil),
|
107
|
+
nic_hot_plug: (config.key?(:nic_hot_plug) ? config[:nic_hot_plug].to_s.downcase == 'true' : nil),
|
108
|
+
nic_hot_unplug: (config.key?(:nic_hot_unplug) ? config[:nic_hot_unplug].to_s.downcase == 'true' : nil),
|
109
|
+
disc_virtio_hot_plug: (config.key?(:disc_virtio_hot_plug) ? config[:disc_virtio_hot_plug].to_s.downcase == 'true' : nil),
|
110
|
+
disc_virtio_hot_unplug: (config.key?(:disc_virtio_hot_unplug) ? config[:disc_virtio_hot_unplug].to_s.downcase == 'true' : nil),
|
111
|
+
disc_scsi_hot_plug: (config.key?(:disc_scsi_hot_plug) ? config[:disc_scsi_hot_plug].to_s.downcase == 'true' : nil),
|
112
|
+
disc_scsi_hot_unplug: (config.key?(:disc_scsi_hot_unplug) ? config[:disc_scsi_hot_unplug].to_s.downcase == 'true' : nil),
|
113
|
+
),
|
114
|
+
)
|
115
|
+
|
116
|
+
dot = ui.color('.', :magenta)
|
117
|
+
api_client.wait_for { print dot; is_done? get_request_id headers }
|
118
|
+
else
|
119
|
+
ui.warn("Nothing to update, please set one of the attributes #{@updatable_fields}.")
|
120
|
+
end
|
121
|
+
|
122
|
+
print_snapshot(server_api.snapshots_find_by_id(config[:snapshot_id]))
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
@@ -70,14 +70,7 @@ class Chef
|
|
70
70
|
dot = ui.color('.', :magenta)
|
71
71
|
api_client.wait_for { print dot; is_done? get_request_id headers }
|
72
72
|
|
73
|
-
|
74
|
-
puts "#{ui.color('ID', :cyan)}: #{user.id}"
|
75
|
-
puts "#{ui.color('Firstname', :cyan)}: #{user.properties.firstname}"
|
76
|
-
puts "#{ui.color('Lastname', :cyan)}: #{user.properties.lastname}"
|
77
|
-
puts "#{ui.color('Email', :cyan)}: #{user.properties.email}"
|
78
|
-
puts "#{ui.color('Administrator', :cyan)}: #{user.properties.administrator.to_s}"
|
79
|
-
puts "#{ui.color('2-Factor Auth', :cyan)}: #{user.properties.force_sec_auth.to_s}"
|
80
|
-
puts 'done'
|
73
|
+
print_user(user)
|
81
74
|
end
|
82
75
|
end
|
83
76
|
end
|
@@ -34,12 +34,7 @@ class Chef
|
|
34
34
|
next
|
35
35
|
end
|
36
36
|
|
37
|
-
|
38
|
-
msg_pair('Firstname', user.properties.firstname)
|
39
|
-
msg_pair('Lastname', user.properties.lastname)
|
40
|
-
msg_pair('Email', user.properties.email)
|
41
|
-
msg_pair('Administrator', user.properties.administrator.to_s)
|
42
|
-
msg_pair('2-Factor Auth', user.properties.force_sec_auth.to_s)
|
37
|
+
print_user(user)
|
43
38
|
puts "\n"
|
44
39
|
|
45
40
|
begin
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudUserGet < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud user get (options)'
|
9
|
+
|
10
|
+
option :user_id,
|
11
|
+
short: '-U USER_ID',
|
12
|
+
long: '--user-id USER_ID',
|
13
|
+
description: 'ID of the group.'
|
14
|
+
|
15
|
+
attr_reader :description, :required_options
|
16
|
+
|
17
|
+
def initialize(args = [])
|
18
|
+
super(args)
|
19
|
+
@description =
|
20
|
+
'Retrieves the attributes of a given Ionoscloud User.'
|
21
|
+
@required_options = [:user_id, :ionoscloud_username, :ionoscloud_password]
|
22
|
+
end
|
23
|
+
|
24
|
+
def run
|
25
|
+
$stdout.sync = true
|
26
|
+
handle_extra_config
|
27
|
+
validate_required_params(@required_options, config)
|
28
|
+
print_user(Ionoscloud::UserManagementApi.new(api_client).um_users_find_by_id(config[:user_id]))
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudUserUpdate < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud user update (options)'
|
9
|
+
|
10
|
+
option :user_id,
|
11
|
+
short: '-U USER_ID',
|
12
|
+
long: '--user-id USER_ID',
|
13
|
+
description: 'ID of the User.'
|
14
|
+
|
15
|
+
option :firstname,
|
16
|
+
short: '-f FIRSTNAME',
|
17
|
+
long: '--firstname FIRSTNAME',
|
18
|
+
description: 'Firstname of the user.'
|
19
|
+
|
20
|
+
option :lastname,
|
21
|
+
short: '-l LASTNAME',
|
22
|
+
long: '--lastname LASTNAME',
|
23
|
+
description: 'Lastname of the user.'
|
24
|
+
|
25
|
+
option :email,
|
26
|
+
long: '--email EMAIL',
|
27
|
+
description: 'An e-mail address for the user.'
|
28
|
+
|
29
|
+
option :administrator,
|
30
|
+
short: '-a ADMIN',
|
31
|
+
long: '--admin ADMIN',
|
32
|
+
description: 'Assigns the user have administrative rights.'
|
33
|
+
|
34
|
+
option :force_sec_auth,
|
35
|
+
long: '--sec-auth FORCE_SEC_AUTH',
|
36
|
+
description: 'Indicates if secure (two-factor) authentication should be forced for the user.'
|
37
|
+
|
38
|
+
option :sec_auth_active,
|
39
|
+
long: '--sec-auth SEC_AUTH_ACTIVE',
|
40
|
+
description: 'Indicates if secure authentication is active for the user or not.'
|
41
|
+
|
42
|
+
option :active,
|
43
|
+
long: '--active ACTIVE',
|
44
|
+
description: 'Indicates if the user is active.'
|
45
|
+
|
46
|
+
attr_reader :description, :required_options
|
47
|
+
|
48
|
+
def initialize(args = [])
|
49
|
+
super(args)
|
50
|
+
@description =
|
51
|
+
'Updates information about a Ionoscloud User.'
|
52
|
+
@required_options = [:user_id, :ionoscloud_username, :ionoscloud_password]
|
53
|
+
@updatable_fields = [:firstname, :lastname, :email, :administrator, :force_sec_auth, :sec_auth_active, :active]
|
54
|
+
end
|
55
|
+
|
56
|
+
def run
|
57
|
+
$stdout.sync = true
|
58
|
+
handle_extra_config
|
59
|
+
validate_required_params(@required_options, config)
|
60
|
+
|
61
|
+
user_management_api = Ionoscloud::UserManagementApi.new(api_client)
|
62
|
+
|
63
|
+
if @updatable_fields.map { |el| config[el] }.any?
|
64
|
+
print "#{ui.color('Updating User...', :magenta)}"
|
65
|
+
|
66
|
+
user = user_management_api.um_users_find_by_id(config[:user_id])
|
67
|
+
|
68
|
+
new_user = Ionoscloud::UserPut.new(
|
69
|
+
properties: Ionoscloud::UserPropertiesPut.new(
|
70
|
+
firstname: config[:firstname] || user.properties.firstname,
|
71
|
+
lastname: config[:lastname] || user.properties.lastname,
|
72
|
+
email: config[:email] || user.properties.email,
|
73
|
+
administrator: (config.key?(:administrator) ? config[:administrator].to_s.downcase == 'true' : user.properties.administrator),
|
74
|
+
force_sec_auth: (config.key?(:force_sec_auth) ? config[:force_sec_auth].to_s.downcase == 'true' : user.properties.force_sec_auth),
|
75
|
+
sec_auth_active: (config.key?(:sec_auth_active) ? config[:sec_auth_active].to_s.downcase == 'true' : user.properties.sec_auth_active),
|
76
|
+
active: (config.key?(:active) ? config[:active].to_s.downcase == 'true' : user.properties.active),
|
77
|
+
),
|
78
|
+
)
|
79
|
+
|
80
|
+
_, _, headers = user_management_api.um_users_put_with_http_info(config[:user_id], new_user)
|
81
|
+
|
82
|
+
dot = ui.color('.', :magenta)
|
83
|
+
api_client.wait_for { print dot; is_done? get_request_id headers }
|
84
|
+
else
|
85
|
+
ui.warn("Nothing to update, please set one of the attributes #{@updatable_fields}.")
|
86
|
+
end
|
87
|
+
|
88
|
+
print_user(user_management_api.um_users_find_by_id(config[:user_id]))
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -114,18 +114,7 @@ class Chef
|
|
114
114
|
dot = ui.color('.', :magenta)
|
115
115
|
api_client.wait_for(300) { print dot; is_done? get_request_id headers }
|
116
116
|
|
117
|
-
|
118
|
-
|
119
|
-
puts "\n"
|
120
|
-
puts "#{ui.color('ID', :cyan)}: #{volume.id}"
|
121
|
-
puts "#{ui.color('Name', :cyan)}: #{volume.properties.name}"
|
122
|
-
puts "#{ui.color('Size', :cyan)}: #{volume.properties.size}"
|
123
|
-
puts "#{ui.color('Bus', :cyan)}: #{volume.properties.bus}"
|
124
|
-
puts "#{ui.color('Image', :cyan)}: #{volume.properties.image}"
|
125
|
-
puts "#{ui.color('Type', :cyan)}: #{volume.properties.type}"
|
126
|
-
puts "#{ui.color('Licence Type', :cyan)}: #{volume.properties.licence_type}"
|
127
|
-
puts "#{ui.color('Zone', :cyan)}: #{volume.properties.availability_zone}"
|
128
|
-
puts 'done'
|
117
|
+
print_volume(volume_api.datacenters_volumes_find_by_id(config[:datacenter_id], volume.id))
|
129
118
|
end
|
130
119
|
end
|
131
120
|
end
|
@@ -41,14 +41,8 @@ class Chef
|
|
41
41
|
next
|
42
42
|
end
|
43
43
|
|
44
|
-
|
45
|
-
|
46
|
-
msg_pair('Size', volume.properties.size)
|
47
|
-
msg_pair('Bus', volume.properties.bus)
|
48
|
-
msg_pair('Image', volume.properties.image)
|
49
|
-
msg_pair('Type', volume.properties.type)
|
50
|
-
msg_pair('Licence Type', volume.properties.licence_type)
|
51
|
-
msg_pair('Zone', volume.properties.availability_zone)
|
44
|
+
print_volume(volume)
|
45
|
+
puts "\n"
|
52
46
|
|
53
47
|
begin
|
54
48
|
confirm('Do you really want to delete this volume')
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudVolumeGet < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud volume 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 :volume_id,
|
16
|
+
long: '--volume VOLUME_ID',
|
17
|
+
description: 'ID of the volume.'
|
18
|
+
|
19
|
+
attr_reader :description, :required_options
|
20
|
+
|
21
|
+
def initialize(args = [])
|
22
|
+
super(args)
|
23
|
+
@description =
|
24
|
+
'Retrieves the attributes of a given Volume.'
|
25
|
+
@required_options = [:datacenter_id, :volume_id, :ionoscloud_username, :ionoscloud_password]
|
26
|
+
end
|
27
|
+
|
28
|
+
def run
|
29
|
+
$stdout.sync = true
|
30
|
+
handle_extra_config
|
31
|
+
validate_required_params(@required_options, config)
|
32
|
+
print_volume(Ionoscloud::VolumesApi.new(api_client).datacenters_volumes_find_by_id(config[:datacenter_id], config[:volume_id]))
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|