Sha256: 79a985797ca608611202f7c3ec8698c2932ed96176512cc34add6910ec6f6197

Contents?: true

Size: 1.03 KB

Versions: 9

Compression:

Stored size: 1.03 KB

Contents

module Katello
  module Concerns
    module Api::V2::HostsControllerExtensions
      extend ActiveSupport::Concern
      include ForemanTasks::Triggers

      included do
        def destroy
          sync_task(::Actions::Katello::Host::Destroy, @host)
          process_response(:object => @host)
        end

        api :PUT, "/hosts/:host_id/host_collections", N_("Alter a hosts host collections")
        param :host_id, :identifier, :required => true, :desc => N_("The id of the host to alter")
        param :host_collection_ids, Array, :required => true, :desc => N_("List of host collection ids to update")
        def host_collections
          @host.host_collection_ids = params[:host_collection_ids]
          @host.save!
          render(:locals => { :resource => @host }, :template => 'katello/api/v2/hosts/show', :status => 200)
        end

        def action_permission
          case params[:action]
          when 'host_collections'
            'edit'
          else
            super
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
katello-3.0.2 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.0.1 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.0.0 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.0.0.rc7 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.0.0.rc5 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.0.0.rc4 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.0.0.rc3 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.0.0.rc2 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb
katello-3.0.0.rc1 app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb