Class: Kontena::Plugin::Cloud::Organization::User::RemoveCommand

Inherits:
Command
  • Object
show all
Includes:
Cli::Common
Defined in:
lib/kontena/plugin/cloud/organization/user/remove_command.rb

Constant Summary

Constants included from CloudCommand

CloudCommand::PLATFORM_NOT_SELECTED_ERROR

Instance Method Summary collapse

Methods included from CloudCommand

#verify_current_grid, #verify_current_master, #verify_current_master_token

Instance Method Details

#executeObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/kontena/plugin/cloud/organization/user/remove_command.rb', line 11

def execute
  confirm_command(username_list.join(',')) unless forced?

  members = []
  username_list.each do |u|
    members << {
      type: 'users',
      id: u
    }
  end
  spinner "Removing #{pastel.cyan(username_list.join(', '))} from organization #{pastel.cyan(name)}" do
    data = {data: members}
    cloud_client.delete("/organizations/#{name}/relationships/members", data)
  end
end