Sha256: 6b380e7163f19e5e5b32822ef2a3b9d31974eda98724c3c6cbfa817404ec5a95

Contents?: true

Size: 1.44 KB

Versions: 11

Compression:

Stored size: 1.44 KB

Contents

module ForemanSalt
  module Api
    module V2
      class SaltMinionsController < ::ForemanSalt::Api::V2::BaseController
        before_action :find_resource, :except => [:index]

        api :GET, '/salt_minions', N_('List all Salt Minions')
        param_group :search_and_pagination, ::Api::V2::BaseController
        def index
          @salt_minions = resource_scope_for_index
        end

        api :GET, '/salt_minions/:id', N_('Show a minion')
        param :id, :identifier_dottable, :required => true
        def show
          @salt_states = @salt_minion.salt_modules
        end

        def_param_group :minion do
          param :minion, Hash, :required => true, :action_aware => true do
            param :salt_environment_id, :number, :desc => N_('Salt environment ID')
            param :salt_proxy_id, :number, :desc => N_('ID of Salt Proxy')
            param :salt_state_ids, Array, :desc => N_('Array of State ids')
          end
        end

        api :PUT, '/salt_minions/:id/', N_('Update a minion')
        param :id, :identifier_dottable, :required => true
        param_group :minion
        def update
          params[:minion][:salt_module_ids] = params[:minion].delete(:salt_state_ids) if params[:minion]
          process_response @salt_minion.update_attributes(params[:minion])
        end

        def controller_permission
          'hosts'
        end

        def resource_class
          Host
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
foreman_salt-9.0.0 app/controllers/foreman_salt/api/v2/salt_minions_controller.rb
foreman_salt-8.0.3 app/controllers/foreman_salt/api/v2/salt_minions_controller.rb
foreman_salt-8.0.2 app/controllers/foreman_salt/api/v2/salt_minions_controller.rb
foreman_salt-8.0.1 app/controllers/foreman_salt/api/v2/salt_minions_controller.rb
foreman_salt-7.0.3 app/controllers/foreman_salt/api/v2/salt_minions_controller.rb
foreman_salt-8.0.0 app/controllers/foreman_salt/api/v2/salt_minions_controller.rb
foreman_salt-7.0.2 app/controllers/foreman_salt/api/v2/salt_minions_controller.rb
foreman_salt-6.0.1 app/controllers/foreman_salt/api/v2/salt_minions_controller.rb
foreman_salt-7.0.1 app/controllers/foreman_salt/api/v2/salt_minions_controller.rb
foreman_salt-7.0.0 app/controllers/foreman_salt/api/v2/salt_minions_controller.rb
foreman_salt-6.0.0 app/controllers/foreman_salt/api/v2/salt_minions_controller.rb