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, AuthSourceLdap::ListCommand, CommonParameter::ListCommand, ComputeResource::AvailableNetworksCommand, ComputeResource::ListCommand, ConfigGroup::ListCommand, Domain::ListCommand, Environment::ListCommand, ExternalUsergroup::ListCommand, ExternalUsergroup::RefreshExternalUsergroupsCommand, Fact::ListCommand, Filter::AvailablePermissionsCommand, Filter::AvailableResourcesCommand, Filter::ListCommand, Host::ListCommand, Host::PuppetClassesCommand, Hostgroup::ListCommand, Hostgroup::PuppetClassesCommand, Image::AvailableImagesCommand, Image::ListCommand, Interface::ListCommand, HammerCLIForeman::Location::ListCommand, Medium::ListCommand, Model::ListCommand, OperatingSystem::ListCommand, Organization::ListCommand, PartitionTable::ListCommand, PuppetClass::ListCommand, Realm::ListCommand, Report::ListCommand, Role::FiltersCommand, Role::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, #request_params, #resolver, resolver, resource_config, resource_name_mapping, #searchables, searchables
Class Method Details
.command_name(name = nil) ⇒ Object
269
270
271
|
# File 'lib/hammer_cli_foreman/commands.rb', line 269
def self.command_name(name=nil)
super(name) || "list"
end
|
Instance Method Details
#adapter ⇒ Object
251
252
253
|
# File 'lib/hammer_cli_foreman/commands.rb', line 251
def adapter
@context[:adapter] || :table
end
|
#execute ⇒ Object
273
274
275
276
277
278
279
280
281
282
283
|
# File 'lib/hammer_cli_foreman/commands.rb', line 273
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
265
266
267
|
# File 'lib/hammer_cli_foreman/commands.rb', line 265
def extend_data(record)
record
end
|
#send_request ⇒ Object
255
256
257
258
259
|
# File 'lib/hammer_cli_foreman/commands.rb', line 255
def send_request
set = super
set.map! { |r| extend_data(r) }
set
end
|
261
262
263
|
# File 'lib/hammer_cli_foreman/commands.rb', line 261
def transform_format(data)
HammerCLIForeman.collection_to_common_format(data)
end
|