Sha256: bec121f0d0b5a6046200746ee56264bf6ed34f9c3b8f365e85414e443f6a26de

Contents?: true

Size: 1.33 KB

Versions: 121

Compression:

Stored size: 1.33 KB

Contents

module Katello
  class Api::V2::HostModuleStreamsController < Api::V2::ApiController
    include Katello::Concerns::FilteredAutoCompleteSearch

    before_action :find_host

    resource_description do
      api_version 'v2'
      api_base_url "/api"
    end

    api :GET, "/hosts/:host_id/module_streams", N_("List module streams available to the host")
    param :host_id, :number, :required => true, :desc => N_("ID of the host")
    param :status, ::Katello::HostAvailableModuleStream::API_STATES.keys, :desc => N_("Streams based on the host based on their status")
    param_group :search, Api::V2::ApiController
    def index
      collection = scoped_search(index_relation, :name, :asc, :resource_class => ::Katello::HostAvailableModuleStream)
      respond_for_index(:collection => collection)
    end

    def index_relation
      return HostAvailableModuleStream.upgradable([@host]) if params[:status] == HostAvailableModuleStream::UPGRADABLE

      rel = @host.host_available_module_streams
      return rel if params[:status].blank?
      rel.send(::Katello::HostAvailableModuleStream::API_STATES[params[:status]])
    end

    def resource_class
      Katello::HostAvailableModuleStream
    end

    private

    def find_host
      @host = resource_finder(::Host::Managed.authorized(:view_hosts, ::Host::Managed), params[:host_id])
    end
  end
end

Version data entries

121 entries across 121 versions & 1 rubygems

Version Path
katello-4.4.2.2 app/controllers/katello/api/v2/host_module_streams_controller.rb
katello-4.4.2.1 app/controllers/katello/api/v2/host_module_streams_controller.rb
katello-4.4.2 app/controllers/katello/api/v2/host_module_streams_controller.rb
katello-4.4.1 app/controllers/katello/api/v2/host_module_streams_controller.rb
katello-4.4.0.2 app/controllers/katello/api/v2/host_module_streams_controller.rb
katello-4.4.0.1 app/controllers/katello/api/v2/host_module_streams_controller.rb
katello-4.3.1 app/controllers/katello/api/v2/host_module_streams_controller.rb
katello-4.4.0 app/controllers/katello/api/v2/host_module_streams_controller.rb
katello-4.4.0.rc2 app/controllers/katello/api/v2/host_module_streams_controller.rb
katello-4.4.0.rc1 app/controllers/katello/api/v2/host_module_streams_controller.rb
katello-4.2.2 app/controllers/katello/api/v2/host_module_streams_controller.rb
katello-4.3.0 app/controllers/katello/api/v2/host_module_streams_controller.rb
katello-4.3.0.rc4 app/controllers/katello/api/v2/host_module_streams_controller.rb
katello-4.3.0.rc3 app/controllers/katello/api/v2/host_module_streams_controller.rb
katello-4.3.0.rc2.1 app/controllers/katello/api/v2/host_module_streams_controller.rb
katello-4.3.0.rc2 app/controllers/katello/api/v2/host_module_streams_controller.rb
katello-4.3.0.rc1 app/controllers/katello/api/v2/host_module_streams_controller.rb
katello-4.2.1 app/controllers/katello/api/v2/host_module_streams_controller.rb
katello-4.2.0.1 app/controllers/katello/api/v2/host_module_streams_controller.rb
katello-4.1.4 app/controllers/katello/api/v2/host_module_streams_controller.rb