knife-ionoscloud 5.1.1 → 5.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/README.md +5 -6
- data/docs/subcommands/backupunit_create.md +1 -1
- data/docs/subcommands/backupunit_get.md +35 -0
- data/docs/subcommands/backupunit_update.md +41 -0
- data/docs/subcommands/datacenter_get.md +35 -0
- data/docs/subcommands/datacenter_update.md +44 -0
- data/docs/subcommands/firewall_create.md +1 -1
- data/docs/subcommands/firewall_get.md +47 -0
- data/docs/subcommands/firewall_update.md +71 -0
- data/docs/subcommands/group_update.md +65 -0
- data/docs/subcommands/ipblock_get.md +35 -0
- data/docs/subcommands/ipblock_update.md +38 -0
- data/docs/subcommands/k8s_create.md +8 -5
- data/docs/subcommands/k8s_get.md +35 -0
- data/docs/subcommands/k8s_update.md +53 -0
- data/docs/subcommands/lan_get.md +39 -0
- data/docs/subcommands/lan_update.md +51 -0
- data/docs/subcommands/loadbalancer_create.md +1 -1
- data/docs/subcommands/loadbalancer_update.md +48 -0
- data/docs/subcommands/nic_create.md +3 -3
- data/docs/subcommands/nic_delete.md +1 -1
- data/docs/subcommands/nic_get.md +43 -0
- data/docs/subcommands/nic_update.md +58 -0
- data/docs/subcommands/node_get.md +43 -0
- data/docs/subcommands/nodepool_create.md +11 -5
- data/docs/subcommands/nodepool_get.md +39 -0
- data/docs/subcommands/nodepool_update.md +69 -0
- data/docs/subcommands/pcc_get.md +35 -0
- data/docs/subcommands/pcc_update.md +41 -0
- data/docs/subcommands/request_get.md +35 -0
- data/docs/subcommands/s3key_get.md +39 -0
- data/docs/subcommands/server_get.md +39 -0
- data/docs/subcommands/server_update.md +60 -0
- data/docs/subcommands/share_create.md +1 -1
- data/docs/subcommands/share_delete.md +2 -2
- data/docs/subcommands/share_get.md +39 -0
- data/docs/subcommands/share_update.md +45 -0
- data/docs/subcommands/snapshot_get.md +35 -0
- data/docs/subcommands/snapshot_update.md +77 -0
- data/docs/subcommands/user_create.md +9 -3
- data/docs/subcommands/user_get.md +35 -0
- data/docs/subcommands/user_update.md +56 -0
- data/docs/subcommands/volume_create.md +19 -1
- data/docs/subcommands/volume_get.md +39 -0
- data/docs/subcommands/volume_update.md +66 -0
- data/docs/summary.md +33 -0
- data/lib/chef/knife/ionoscloud_backupunit_create.rb +10 -15
- 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 +236 -6
- data/lib/chef/knife/ionoscloud_composite_server_create.rb +1 -13
- data/lib/chef/knife/ionoscloud_datacenter_create.rb +10 -13
- data/lib/chef/knife/ionoscloud_datacenter_delete.rb +1 -7
- data/lib/chef/knife/ionoscloud_datacenter_get.rb +33 -0
- data/lib/chef/knife/ionoscloud_datacenter_list.rb +3 -1
- data/lib/chef/knife/ionoscloud_datacenter_update.rb +67 -0
- data/lib/chef/knife/ionoscloud_firewall_create.rb +2 -13
- data/lib/chef/knife/ionoscloud_firewall_delete.rb +2 -10
- data/lib/chef/knife/ionoscloud_firewall_get.rb +50 -0
- data/lib/chef/knife/ionoscloud_firewall_update.rb +131 -0
- data/lib/chef/knife/ionoscloud_group_create.rb +17 -27
- data/lib/chef/knife/ionoscloud_group_delete.rb +1 -11
- data/lib/chef/knife/ionoscloud_group_get.rb +1 -11
- data/lib/chef/knife/ionoscloud_group_list.rb +13 -7
- data/lib/chef/knife/ionoscloud_group_update.rb +114 -0
- data/lib/chef/knife/ionoscloud_group_user_add.rb +1 -13
- data/lib/chef/knife/ionoscloud_group_user_remove.rb +1 -13
- data/lib/chef/knife/ionoscloud_ipblock_create.rb +10 -13
- data/lib/chef/knife/ionoscloud_ipblock_delete.rb +2 -4
- data/lib/chef/knife/ionoscloud_ipblock_get.rb +33 -0
- data/lib/chef/knife/ionoscloud_ipblock_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_ipblock_update.rb +57 -0
- data/lib/chef/knife/ionoscloud_ipfailover_add.rb +7 -14
- data/lib/chef/knife/ionoscloud_ipfailover_remove.rb +1 -8
- data/lib/chef/knife/ionoscloud_k8s_create.rb +27 -30
- 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 +3 -1
- data/lib/chef/knife/ionoscloud_lan_update.rb +87 -0
- data/lib/chef/knife/ionoscloud_loadbalancer_create.rb +3 -14
- data/lib/chef/knife/ionoscloud_loadbalancer_delete.rb +1 -9
- data/lib/chef/knife/ionoscloud_loadbalancer_get.rb +3 -13
- data/lib/chef/knife/ionoscloud_loadbalancer_nic_add.rb +3 -13
- data/lib/chef/knife/ionoscloud_loadbalancer_nic_remove.rb +3 -13
- data/lib/chef/knife/ionoscloud_loadbalancer_update.rb +73 -0
- data/lib/chef/knife/ionoscloud_nic_create.rb +14 -27
- data/lib/chef/knife/ionoscloud_nic_delete.rb +3 -8
- data/lib/chef/knife/ionoscloud_nic_get.rb +47 -0
- data/lib/chef/knife/ionoscloud_nic_update.rb +93 -0
- data/lib/chef/knife/ionoscloud_node_delete.rb +1 -6
- data/lib/chef/knife/ionoscloud_node_get.rb +47 -0
- data/lib/chef/knife/ionoscloud_nodepool_create.rb +45 -52
- data/lib/chef/knife/ionoscloud_nodepool_delete.rb +1 -7
- data/lib/chef/knife/ionoscloud_nodepool_get.rb +41 -0
- data/lib/chef/knife/ionoscloud_nodepool_update.rb +124 -0
- data/lib/chef/knife/ionoscloud_pcc_create.rb +10 -16
- 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 +1 -9
- data/lib/chef/knife/ionoscloud_server_get.rb +41 -0
- data/lib/chef/knife/ionoscloud_server_update.rb +97 -0
- data/lib/chef/knife/ionoscloud_share_create.rb +7 -12
- data/lib/chef/knife/ionoscloud_share_delete.rb +2 -4
- 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_update.rb +126 -0
- data/lib/chef/knife/ionoscloud_user_create.rb +24 -20
- data/lib/chef/knife/ionoscloud_user_delete.rb +1 -7
- 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 +43 -23
- data/lib/chef/knife/ionoscloud_volume_delete.rb +1 -8
- data/lib/chef/knife/ionoscloud_volume_detach.rb +1 -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 +10 -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_list_spec.rb +3 -1
- data/spec/chef/knife/ionoscloud_datacenter_update_spec.rb +82 -0
- data/spec/chef/knife/ionoscloud_firewall_get_spec.rb +76 -0
- data/spec/chef/knife/ionoscloud_firewall_update_spec.rb +116 -0
- data/spec/chef/knife/ionoscloud_group_create_spec.rb +7 -0
- data/spec/chef/knife/ionoscloud_group_delete_spec.rb +3 -0
- data/spec/chef/knife/ionoscloud_group_get_spec.rb +3 -0
- data/spec/chef/knife/ionoscloud_group_list_spec.rb +17 -8
- data/spec/chef/knife/ionoscloud_group_update_spec.rb +109 -0
- data/spec/chef/knife/ionoscloud_group_user_add_spec.rb +3 -0
- data/spec/chef/knife/ionoscloud_group_user_remove_spec.rb +3 -0
- data/spec/chef/knife/ionoscloud_ipblock_delete_spec.rb +2 -0
- data/spec/chef/knife/ionoscloud_ipblock_get_spec.rb +66 -0
- data/spec/chef/knife/ionoscloud_ipblock_list_spec.rb +1 -1
- data/spec/chef/knife/ionoscloud_ipblock_update_spec.rb +79 -0
- data/spec/chef/knife/ionoscloud_ipfailover_add_spec.rb +2 -1
- data/spec/chef/knife/ionoscloud_ipfailover_remove_spec.rb +4 -3
- data/spec/chef/knife/ionoscloud_k8s_create_spec.rb +8 -0
- data/spec/chef/knife/ionoscloud_k8s_delete_spec.rb +7 -1
- data/spec/chef/knife/ionoscloud_k8s_get_spec.rb +73 -0
- data/spec/chef/knife/ionoscloud_k8s_update_spec.rb +115 -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_list_spec.rb +3 -1
- data/spec/chef/knife/ionoscloud_lan_update_spec.rb +91 -0
- data/spec/chef/knife/ionoscloud_loadbalancer_update_spec.rb +89 -0
- data/spec/chef/knife/ionoscloud_nic_get_spec.rb +70 -0
- data/spec/chef/knife/ionoscloud_nic_update_spec.rb +92 -0
- data/spec/chef/knife/ionoscloud_node_get_spec.rb +70 -0
- data/spec/chef/knife/ionoscloud_nodepool_create_spec.rb +12 -5
- data/spec/chef/knife/ionoscloud_nodepool_delete_spec.rb +27 -13
- data/spec/chef/knife/ionoscloud_nodepool_get_spec.rb +83 -0
- data/spec/chef/knife/ionoscloud_nodepool_update_spec.rb +130 -0
- data/spec/chef/knife/ionoscloud_pcc_create_spec.rb +5 -2
- data/spec/chef/knife/ionoscloud_pcc_delete_spec.rb +1 -1
- 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_request_list_spec.rb +9 -8
- data/spec/chef/knife/ionoscloud_s3key_get_spec.rb +66 -0
- data/spec/chef/knife/ionoscloud_server_get_spec.rb +71 -0
- data/spec/chef/knife/ionoscloud_server_update_spec.rb +102 -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 +13 -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_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 +9 -0
- data/spec/chef/knife/ionoscloud_volume_delete_spec.rb +9 -0
- data/spec/chef/knife/ionoscloud_volume_detach_spec.rb +9 -0
- data/spec/chef/knife/ionoscloud_volume_get_spec.rb +80 -0
- data/spec/chef/knife/ionoscloud_volume_update_spec.rb +115 -0
- data/spec/spec_helper.rb +90 -50
- metadata +134 -2
@@ -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::SnapshotApi.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
|
@@ -18,7 +18,6 @@ class Chef
|
|
18
18
|
description: 'Lastname of the user.'
|
19
19
|
|
20
20
|
option :email,
|
21
|
-
short: '-e EMAIL',
|
22
21
|
long: '--email EMAIL',
|
23
22
|
description: 'An e-mail address for the user.'
|
24
23
|
|
@@ -33,9 +32,17 @@ class Chef
|
|
33
32
|
description: 'Assigns the user have administrative rights.'
|
34
33
|
|
35
34
|
option :force_sec_auth,
|
36
|
-
long: '--sec-auth',
|
35
|
+
long: '--force-sec-auth',
|
37
36
|
description: 'Indicates if secure (two-factor) authentication should be forced for the user.'
|
38
37
|
|
38
|
+
option :sec_auth_active,
|
39
|
+
long: '--sec-auth',
|
40
|
+
description: 'Indicates if secure authentication is active for the user or not.'
|
41
|
+
|
42
|
+
option :active,
|
43
|
+
long: '--active',
|
44
|
+
description: 'Indicates if the user is active.'
|
45
|
+
|
39
46
|
attr_reader :description, :required_options
|
40
47
|
|
41
48
|
def initialize(args = [])
|
@@ -56,28 +63,25 @@ class Chef
|
|
56
63
|
|
57
64
|
user_management_api = Ionoscloud::UserManagementApi.new(api_client)
|
58
65
|
|
59
|
-
user, _, headers = user_management_api.um_users_post_with_http_info(
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
66
|
+
user, _, headers = user_management_api.um_users_post_with_http_info(
|
67
|
+
Ionoscloud::UserPost.new(
|
68
|
+
properties: Ionoscloud::UserPropertiesPost.new(
|
69
|
+
firstname: config[:firstname],
|
70
|
+
lastname: config[:lastname],
|
71
|
+
email: config[:email],
|
72
|
+
password: config[:password],
|
73
|
+
administrator: config[:administrator],
|
74
|
+
force_sec_auth: config[:force_sec_auth],
|
75
|
+
sec_auth_active: config[:sec_auth_active],
|
76
|
+
active: config[:active],
|
77
|
+
),
|
78
|
+
),
|
79
|
+
)
|
69
80
|
|
70
81
|
dot = ui.color('.', :magenta)
|
71
82
|
api_client.wait_for { print dot; is_done? get_request_id headers }
|
72
83
|
|
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'
|
84
|
+
print_user(user)
|
81
85
|
end
|
82
86
|
end
|
83
87
|
end
|
@@ -34,13 +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)
|
43
|
-
puts "\n"
|
37
|
+
print_user(user)
|
44
38
|
|
45
39
|
begin
|
46
40
|
confirm('Do you really want to delete this User')
|
@@ -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
|
@@ -25,7 +25,8 @@ class Chef
|
|
25
25
|
option :bus,
|
26
26
|
short: '-b BUS',
|
27
27
|
long: '--bus BUS',
|
28
|
-
description: 'The bus type of the volume (VIRTIO or IDE)'
|
28
|
+
description: 'The bus type of the volume (VIRTIO or IDE)',
|
29
|
+
default: 'VIRTIO'
|
29
30
|
|
30
31
|
option :image,
|
31
32
|
short: '-N ID',
|
@@ -75,6 +76,30 @@ class Chef
|
|
75
76
|
'immutable and is only allowed to be set on a new volume creation. It is mandatory to provide either \'public image\' '\
|
76
77
|
'or \'imageAlias\' that has cloud-init compatibility in conjunction with this property.'
|
77
78
|
|
79
|
+
option :cpu_hot_plug,
|
80
|
+
long: '--cpu-hot-plug CPU_HOT_PLUG',
|
81
|
+
description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
82
|
+
|
83
|
+
option :ram_hot_plug,
|
84
|
+
long: '--ram-hot-plug RAM_HOT_PLUG',
|
85
|
+
description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
86
|
+
|
87
|
+
option :nic_hot_plug,
|
88
|
+
long: '--nic-hot-plug NIC_HOT_PLUG',
|
89
|
+
description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
90
|
+
|
91
|
+
option :nic_hot_unplug,
|
92
|
+
long: '--nic-hot-unplug NIC_HOT_UNPLUG',
|
93
|
+
description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
94
|
+
|
95
|
+
option :disc_virtio_hot_plug,
|
96
|
+
long: '--disc-virtio-hot_plug DISC_VIRTIO_HOT_PLUG',
|
97
|
+
description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
98
|
+
|
99
|
+
option :disc_virtio_hot_unplug,
|
100
|
+
long: '--disc-virtio-hot_unplug DISC_VIRTIO_HOT_UNPLUG',
|
101
|
+
description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
102
|
+
|
78
103
|
attr_reader :description, :required_options
|
79
104
|
|
80
105
|
def initialize(args = [])
|
@@ -98,39 +123,34 @@ class Chef
|
|
98
123
|
|
99
124
|
volume, _, headers = volume_api.datacenters_volumes_post_with_http_info(
|
100
125
|
config[:datacenter_id],
|
101
|
-
|
102
|
-
properties:
|
126
|
+
Ionoscloud::Volume.new(
|
127
|
+
properties: Ionoscloud::VolumeProperties.new(
|
103
128
|
name: config[:name],
|
104
129
|
size: config[:size],
|
105
|
-
bus: config[:bus]
|
130
|
+
bus: config[:bus],
|
106
131
|
type: config[:type],
|
107
|
-
|
132
|
+
licence_type: config[:licence_type],
|
108
133
|
image: config[:image],
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
134
|
+
image_alias: config[:image_alias],
|
135
|
+
ssh_keys: config[:ssh_keys],
|
136
|
+
image_password: config[:image_password],
|
137
|
+
availability_zone: config[:availability_zone],
|
113
138
|
backupunit_id: config[:backupunit_id],
|
114
139
|
user_data: config[:user_data],
|
115
|
-
|
116
|
-
|
140
|
+
cpu_hot_plug: (config.key?(:cpu_hot_plug) ? config[:cpu_hot_plug].to_s.downcase == 'true' : nil),
|
141
|
+
ram_hot_plug: (config.key?(:ram_hot_plug) ? config[:ram_hot_plug].to_s.downcase == 'true' : nil),
|
142
|
+
nic_hot_plug: (config.key?(:nic_hot_plug) ? config[:nic_hot_plug].to_s.downcase == 'true' : nil),
|
143
|
+
nic_hot_unplug: (config.key?(:nic_hot_unplug) ? config[:nic_hot_unplug].to_s.downcase == 'true' : nil),
|
144
|
+
disc_virtio_hot_plug: (config.key?(:disc_virtio_hot_plug) ? config[:disc_virtio_hot_plug].to_s.downcase == 'true' : nil),
|
145
|
+
disc_virtio_hot_unplug: (config.key?(:disc_virtio_hot_unplug) ? config[:disc_virtio_hot_unplug].to_s.downcase == 'true' : nil),
|
146
|
+
),
|
147
|
+
),
|
117
148
|
)
|
118
149
|
|
119
150
|
dot = ui.color('.', :magenta)
|
120
151
|
api_client.wait_for(300) { print dot; is_done? get_request_id headers }
|
121
152
|
|
122
|
-
|
123
|
-
|
124
|
-
puts "\n"
|
125
|
-
puts "#{ui.color('ID', :cyan)}: #{volume.id}"
|
126
|
-
puts "#{ui.color('Name', :cyan)}: #{volume.properties.name}"
|
127
|
-
puts "#{ui.color('Size', :cyan)}: #{volume.properties.size}"
|
128
|
-
puts "#{ui.color('Bus', :cyan)}: #{volume.properties.bus}"
|
129
|
-
puts "#{ui.color('Image', :cyan)}: #{volume.properties.image}"
|
130
|
-
puts "#{ui.color('Type', :cyan)}: #{volume.properties.type}"
|
131
|
-
puts "#{ui.color('Licence Type', :cyan)}: #{volume.properties.licence_type}"
|
132
|
-
puts "#{ui.color('Zone', :cyan)}: #{volume.properties.availability_zone}"
|
133
|
-
puts 'done'
|
153
|
+
print_volume(volume_api.datacenters_volumes_find_by_id(config[:datacenter_id], volume.id))
|
134
154
|
end
|
135
155
|
end
|
136
156
|
end
|
@@ -41,14 +41,7 @@ class Chef
|
|
41
41
|
next
|
42
42
|
end
|
43
43
|
|
44
|
-
|
45
|
-
msg_pair('Name', volume.properties.name)
|
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)
|
52
45
|
|
53
46
|
begin
|
54
47
|
confirm('Do you really want to delete this volume')
|
@@ -49,14 +49,7 @@ class Chef
|
|
49
49
|
next
|
50
50
|
end
|
51
51
|
|
52
|
-
|
53
|
-
msg_pair('Name', volume.properties.name)
|
54
|
-
msg_pair('Size', volume.properties.size)
|
55
|
-
msg_pair('Bus', volume.properties.bus)
|
56
|
-
msg_pair('Image', volume.properties.image)
|
57
|
-
msg_pair('Type', volume.properties.type)
|
58
|
-
msg_pair('Licence Type', volume.properties.licence_type)
|
59
|
-
msg_pair('Zone', volume.properties.availability_zone)
|
52
|
+
print_volume(volume)
|
60
53
|
|
61
54
|
begin
|
62
55
|
confirm('Do you really want to detach 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::VolumeApi.new(api_client).datacenters_volumes_find_by_id(config[:datacenter_id], config[:volume_id]))
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudVolumeUpdate < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud volume update (options)'
|
9
|
+
|
10
|
+
option :datacenter_id,
|
11
|
+
short: '-D DATACENTER_ID',
|
12
|
+
long: '--datacenter-id DATACENTER_ID',
|
13
|
+
description: 'Name of the data center'
|
14
|
+
|
15
|
+
option :volume_id,
|
16
|
+
long: '--volume VOLUME_ID',
|
17
|
+
description: 'ID of the Volume.'
|
18
|
+
|
19
|
+
option :name,
|
20
|
+
short: '-n NAME',
|
21
|
+
long: '--name NAME',
|
22
|
+
description: 'Name of the volume'
|
23
|
+
|
24
|
+
option :size,
|
25
|
+
short: '-S SIZE',
|
26
|
+
long: '--size SIZE',
|
27
|
+
description: 'The size of the volume in GB'
|
28
|
+
|
29
|
+
option :bus,
|
30
|
+
short: '-b BUS',
|
31
|
+
long: '--bus BUS',
|
32
|
+
description: 'The bus type of the volume (VIRTIO or IDE)'
|
33
|
+
|
34
|
+
option :cpu_hot_plug,
|
35
|
+
long: '--cpu-hot-plug CPU_HOT_PLUG',
|
36
|
+
description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
37
|
+
|
38
|
+
option :ram_hot_plug,
|
39
|
+
long: '--ram-hot-plug RAM_HOT_PLUG',
|
40
|
+
description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
41
|
+
|
42
|
+
option :nic_hot_plug,
|
43
|
+
long: '--nic-hot-plug NIC_HOT_PLUG',
|
44
|
+
description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
45
|
+
|
46
|
+
option :nic_hot_unplug,
|
47
|
+
long: '--nic-hot-unplug NIC_HOT_UNPLUG',
|
48
|
+
description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
49
|
+
|
50
|
+
option :disc_virtio_hot_plug,
|
51
|
+
long: '--disc-virtio-hot_plug DISC_VIRTIO_HOT_PLUG',
|
52
|
+
description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
53
|
+
|
54
|
+
option :disc_virtio_hot_unplug,
|
55
|
+
long: '--disc-virtio-hot_unplug DISC_VIRTIO_HOT_UNPLUG',
|
56
|
+
description: 'The licence type of the volume (LINUX, WINDOWS, UNKNOWN, OTHER)'
|
57
|
+
|
58
|
+
attr_reader :description, :required_options
|
59
|
+
|
60
|
+
def initialize(args = [])
|
61
|
+
super(args)
|
62
|
+
@description =
|
63
|
+
'Updates information about a Ionoscloud Volume.'
|
64
|
+
@required_options = [:datacenter_id, :volume_id, :ionoscloud_username, :ionoscloud_password]
|
65
|
+
@updatable_fields = [
|
66
|
+
:name, :size, :bus, :cpu_hot_plug, :ram_hot_plug, :nic_hot_plug, :nic_hot_unplug, :disc_virtio_hot_plug, :disc_virtio_hot_unplug,
|
67
|
+
]
|
68
|
+
end
|
69
|
+
|
70
|
+
def run
|
71
|
+
$stdout.sync = true
|
72
|
+
handle_extra_config
|
73
|
+
validate_required_params(@required_options, config)
|
74
|
+
|
75
|
+
volume = Ionoscloud::VolumeApi.new(api_client)
|
76
|
+
|
77
|
+
if @updatable_fields.map { |el| config[el] }.any?
|
78
|
+
print "#{ui.color('Updating Volume...', :magenta)}"
|
79
|
+
|
80
|
+
_, _, headers = volume.datacenters_volumes_patch_with_http_info(
|
81
|
+
config[:datacenter_id],
|
82
|
+
config[:volume_id],
|
83
|
+
Ionoscloud::VolumeProperties.new(
|
84
|
+
name: config[:name],
|
85
|
+
size: config[:size],
|
86
|
+
bus: config[:bus],
|
87
|
+
cpu_hot_plug: (config.key?(:cpu_hot_plug) ? config[:cpu_hot_plug].to_s.downcase == 'true' : nil),
|
88
|
+
ram_hot_plug: (config.key?(:ram_hot_plug) ? config[:ram_hot_plug].to_s.downcase == 'true' : nil),
|
89
|
+
nic_hot_plug: (config.key?(:nic_hot_plug) ? config[:nic_hot_plug].to_s.downcase == 'true' : nil),
|
90
|
+
nic_hot_unplug: (config.key?(:nic_hot_unplug) ? config[:nic_hot_unplug].to_s.downcase == 'true' : nil),
|
91
|
+
disc_virtio_hot_plug: (config.key?(:disc_virtio_hot_plug) ? config[:disc_virtio_hot_plug].to_s.downcase == 'true' : nil),
|
92
|
+
disc_virtio_hot_unplug: (config.key?(:disc_virtio_hot_unplug) ? config[:disc_virtio_hot_unplug].to_s.downcase == 'true' : nil),
|
93
|
+
),
|
94
|
+
)
|
95
|
+
|
96
|
+
dot = ui.color('.', :magenta)
|
97
|
+
api_client.wait_for { print dot; is_done? get_request_id headers }
|
98
|
+
else
|
99
|
+
ui.warn("Nothing to update, please set one of the attributes #{@updatable_fields}.")
|
100
|
+
end
|
101
|
+
|
102
|
+
print_volume(volume.datacenters_volumes_find_by_id(config[:datacenter_id], config[:volume_id]))
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|