Class: Katello::Api::V2::ContentViewEnvironmentsController
- Inherits:
-
ApiController
- Object
- Api::V2::BaseController
- ApiController
- Katello::Api::V2::ContentViewEnvironmentsController
show all
- Defined in:
- app/controllers/katello/api/v2/content_view_environments_controller.rb
Instance Method Summary
collapse
#empty_search_query?, #full_result_response, #resource_class, #scoped_search, #skip_session
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
#find_activation_key ⇒ Object
44
45
46
47
|
# File 'app/controllers/katello/api/v2/content_view_environments_controller.rb', line 44
def find_activation_key
return unless params.key?(:activation_key_id)
@activation_key = ActivationKey.readable.find(params[:activation_key_id])
end
|
#find_content_view ⇒ Object
39
40
41
42
|
# File 'app/controllers/katello/api/v2/content_view_environments_controller.rb', line 39
def find_content_view
return unless params.key?(:content_view_id)
@content_view = ContentView.readable.find(params[:content_view_id])
end
|
#find_environment ⇒ Object
34
35
36
37
|
# File 'app/controllers/katello/api/v2/content_view_environments_controller.rb', line 34
def find_environment
return unless params.key?(:lifecycle_environment_id)
@environment = KTEnvironment.readable.find(params[:lifecycle_environment_id])
end
|
#find_host ⇒ Object
49
50
51
52
|
# File 'app/controllers/katello/api/v2/content_view_environments_controller.rb', line 49
def find_host
return unless params.key?(:host_id)
@host = ::Host::Managed.authorized("view_hosts").find(params[:host_id])
end
|
#index ⇒ Object
20
21
22
|
# File 'app/controllers/katello/api/v2/content_view_environments_controller.rb', line 20
def index
respond(:collection => scoped_search(index_relation.distinct, :id, :asc, resource_class: ContentViewEnvironment))
end
|
#index_relation ⇒ Object
24
25
26
27
28
29
30
31
32
|
# File 'app/controllers/katello/api/v2/content_view_environments_controller.rb', line 24
def index_relation
content_view_environments = ContentViewEnvironment.readable.non_generated
content_view_environments = content_view_environments.in_organization(@organization) if @organization
content_view_environments = content_view_environments.where(environment: @environment) if @environment
content_view_environments = content_view_environments.where(content_view: @content_view) if @content_view
content_view_environments = content_view_environments.where(id: @activation_key.content_view_environments) if @activation_key
content_view_environments = content_view_environments.where(id: @host.content_view_environments) if @host
content_view_environments
end
|