lib/chef/knife/ionoscloud_share_create.rb in knife-ionoscloud-5.1.2 vs lib/chef/knife/ionoscloud_share_create.rb in knife-ionoscloud-6.0.0.alpha.1
- old
+ new
@@ -16,10 +16,11 @@
short: '-R RESOURCE_ID',
long: '--resource-id RESOURCE_ID',
description: 'The ID of the resource.'
option :edit_privilege,
+ short: '-e',
long: '--edit',
description: 'The group has permission to edit privileges on this resource.'
option :share_privilege,
short: '-s',
@@ -37,31 +38,34 @@
@required_options = [:group_id, :resource_id, :ionoscloud_username, :ionoscloud_password]
end
def run
$stdout.sync = true
- handle_extra_config
validate_required_params(@required_options, config)
print "#{ui.color('Sharing Resource...', :magenta)}"
user_management_api = Ionoscloud::UserManagementApi.new(api_client)
share, _, headers = user_management_api.um_groups_shares_post_with_http_info(
config[:group_id],
config[:resource_id],
- Ionoscloud::GroupShare.new(
- properties: Ionoscloud::GroupShareProperties.new(
- edit_privilege: config[:edit_privilege],
- share_privilege: config[:share_privilege],
- ),
- ),
+ {
+ properties: {
+ editPrivilege: config[:edit_privilege],
+ sharePrivilege: config[:share_privilege],
+ }.compact,
+ },
)
dot = ui.color('.', :magenta)
api_client.wait_for { print dot; is_done? get_request_id headers }
- print_share(share)
+ puts "\n"
+ puts "#{ui.color('ID', :cyan)}: #{share.id}"
+ puts "#{ui.color('Edit Privilege', :cyan)}: #{share.properties.edit_privilege.to_s}"
+ puts "#{ui.color('Share Privilege', :cyan)}: #{share.properties.share_privilege.to_s}"
+ puts 'done'
end
end
end
end