Class: HammerCLIForeman::ListCommand
- Inherits:
-
Command
- Object
- HammerCLI::Apipie::Command
- Command
- HammerCLIForeman::ListCommand
show all
- Defined in:
- lib/hammer_cli_foreman/commands.rb
Direct Known Subclasses
Architecture::ListCommand, AssociatedResourceListCommand, Audit::ListCommand, AuthSource::ListCommand, AuthSourceLdap::ListCommand, Combination::ListCombination, CommonParameter::ListCommand, ComputeResource::AvailableNetworksCommand, ComputeResource::ListCommand, ConfigGroup::ListCommand, ConfigReport::ListCommand, Domain::ListCommand, Environment::ListCommand, ExternalUsergroup::ListCommand, ExternalUsergroup::RefreshExternalUsergroupsCommand, Fact::ListCommand, Filter::AvailablePermissionsCommand, Filter::AvailableResourcesCommand, Filter::ListCommand, Host::ConfigReportsCommand, Host::ListCommand, Host::PuppetClassesCommand, Host::ReportsCommand, Hostgroup::ListCommand, Hostgroup::PuppetClassesCommand, Image::AvailableImagesCommand, Image::ListCommand, Interface::ListCommand, HammerCLIForeman::Location::ListCommand, Medium::ListCommand, Model::ListCommand, OperatingSystem::ListCommand, Organization::ListCommand, PartitionTable::ListCommand, PersonalAccessToken::ListCommand, PuppetClass::ListCommand, Realm::ListCommand, Role::FiltersCommand, Role::ListCommand, SSHKeys::ListCommand, Settings::ListCommand, SmartClassParameter::ListCommand, SmartClassParametersBriefList, SmartProxy::ListCommand, SmartVariable::ListCommand, SmartVariablesBriefList, Subnet::ListCommand, Template::ListCommand, Template::ListKindsCommand, User::ListCommand, Usergroup::ListCommand
Constant Summary
collapse
- RETRIEVE_ALL_PER_PAGE =
1000
- DEFAULT_PER_PAGE =
20
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Command
build_options, connection_name, create_option_builder, #customized_options, #dependency_resolver, dependency_resolver, #exception_handler_class, #get_identifier, #get_resource_id, #get_resource_ids, #option_sources, #request_params, #resolver, resolver, resource_config, resource_name_mapping, #searchables, searchables
Class Method Details
.command_name(name = nil) ⇒ Object
237
238
239
|
# File 'lib/hammer_cli_foreman/commands.rb', line 237
def self.command_name(name=nil)
super(name) || "list"
end
|
Instance Method Details
#adapter ⇒ Object
219
220
221
|
# File 'lib/hammer_cli_foreman/commands.rb', line 219
def adapter
@context[:adapter] || :table
end
|
#execute ⇒ Object
241
242
243
244
245
246
247
248
249
250
251
|
# File 'lib/hammer_cli_foreman/commands.rb', line 241
def execute
if should_retrieve_all?
print_data(retrieve_all)
else
self.option_page = (self.option_page || 1).to_i if respond_to?(:option_page)
self.option_per_page = (self.option_per_page || HammerCLI::Settings.get(:ui, :per_page) || DEFAULT_PER_PAGE).to_i if respond_to?(:option_per_page)
print_data(send_request)
end
return HammerCLI::EX_OK
end
|
#extend_data(record) ⇒ Object
233
234
235
|
# File 'lib/hammer_cli_foreman/commands.rb', line 233
def extend_data(record)
record
end
|
#send_request ⇒ Object
223
224
225
226
227
|
# File 'lib/hammer_cli_foreman/commands.rb', line 223
def send_request
set = super
set.map! { |r| extend_data(r) }
set
end
|