Class: Katello::Api::V2::UpstreamSubscriptionsController

Inherits:
ApiController
  • Object
show all
Defined in:
app/controllers/katello/api/v2/upstream_subscriptions_controller.rb

Instance Method Summary collapse

Methods inherited from ApiController

#check_katello_agent_not_disabled, #deprecate_katello_agent, #empty_search_query?, #full_result_response, #katello_agent_removal_release, #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

Methods included from Katello::Api::Version2

#api_version

Instance Method Details

#createObject



66
67
68
69
70
# File 'app/controllers/katello/api/v2/upstream_subscriptions_controller.rb', line 66

def create
  task = async_task(::Actions::Katello::UpstreamSubscriptions::BindEntitlements,
                    bind_entitlements_params)
  respond_for_async resource: task
end

#destroyObject



54
55
56
57
# File 'app/controllers/katello/api/v2/upstream_subscriptions_controller.rb', line 54

def destroy
  task = async_task(::Actions::Katello::UpstreamSubscriptions::RemoveEntitlements, params[:pool_ids])
  respond_for_async :resource => task
end

#indexObject



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/controllers/katello/api/v2/upstream_subscriptions_controller.rb', line 24

def index
  index_params = upstream_pool_params
  pools = UpstreamPool.fetch_pools(index_params)
  page = index_params[:page] || 1

  collection = scoped_search_results(
    query: pools[:pools],
    subtotal: pools[:subtotal],
    total: pools[:total],
    page: page,
    per_page: index_params[:per_page])
  respond(collection: collection)
end

#pingObject



74
75
76
77
78
79
80
81
# File 'app/controllers/katello/api/v2/upstream_subscriptions_controller.rb', line 74

def ping
  # This API raises an error if:
  # - Katello is in disconnected mode
  # - There is no manifest imported
  # - The local manifest identity certs have expired
  # - The manifest has been deleted upstream
  render json: { status: 'OK' }
end

#updateObject



45
46
47
48
# File 'app/controllers/katello/api/v2/upstream_subscriptions_controller.rb', line 45

def update
  task = async_task(::Actions::Katello::UpstreamSubscriptions::UpdateEntitlements, update_params)
  respond_for_async :resource => task
end