Class: Katello::Api::V2::SystemsController
Constant Summary
Concerns::FilteredAutoCompleteSearch::PAGE_SIZE
Instance Method Summary
collapse
#auto_complete_search
#full_result_response, #resource_class, #scoped_search
Methods included from Rendering
#respond_for_async, #respond_for_bulk_async, #respond_for_create, #respond_for_destroy, #respond_for_index, #respond_for_show, #respond_for_status, #respond_for_update, #respond_with_template, #respond_with_template_collection, #respond_with_template_resource, #try_specific_collection_template, #try_specific_resource_template
#api_version
Instance Method Details
#index ⇒ Object
49
50
51
|
# File 'app/controllers/katello/api/v2/systems_controller.rb', line 49
def index
respond(:collection => scoped_search(index_relation.uniq, :name, :asc))
end
|
#index_relation ⇒ Object
53
54
55
56
57
58
59
60
61
62
|
# File 'app/controllers/katello/api/v2/systems_controller.rb', line 53
def index_relation
collection = System.readable
collection = collection.where(:content_view_id => params[:content_view_id]) if params[:content_view_id]
collection = collection.where(:id => Organization.find(params[:organization_id]).systems.map(&:id)) if params[:organization_id]
collection = collection.where(:environment_id => params[:environment_id]) if params[:environment_id]
collection = collection.where(:id => Pool.find(params['pool_id']).systems.map(&:id)) if params['pool_id']
collection = collection.where(:uuid => params['uuid']) if params['uuid']
collection = collection.where(:name => params['name']) if params['name']
collection
end
|
#organization_id_keys ⇒ Object
21
22
23
|
# File 'app/controllers/katello/api/v2/systems_controller.rb', line 21
def organization_id_keys
[:organization_id, :owner]
end
|
#releases ⇒ Object
88
89
90
91
92
93
|
# File 'app/controllers/katello/api/v2/systems_controller.rb', line 88
def releases
response = { :results => @system.available_releases,
:total => @system.available_releases.size,
:subtotal => @system.available_releases.size }
respond_for_index :collection => response
end
|
#show ⇒ Object
79
80
81
|
# File 'app/controllers/katello/api/v2/systems_controller.rb', line 79
def show
respond
end
|
#update ⇒ Object
71
72
73
74
75
|
# File 'app/controllers/katello/api/v2/systems_controller.rb', line 71
def update
host_params = system_params_to_host_params(system_params(params))
@system.foreman_host.update_attributes!(host_params)
respond_for_update
end
|