Sha256: 5082759780948bd3495b5d0e3f56afc5edec6aeb8879d5cebc90f260453359d4

Contents?: true

Size: 1.35 KB

Versions: 4

Compression:

Stored size: 1.35 KB

Contents

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

        api :GET, '/salt_minions', N_('List all Salt Minions')
        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)
          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

4 entries across 4 versions & 1 rubygems

Version Path
foreman_salt-2.1.0 app/controllers/foreman_salt/api/v2/salt_minions_controller.rb
foreman_salt-2.0.2 app/controllers/foreman_salt/api/v2/salt_minions_controller.rb
foreman_salt-2.0.1 app/controllers/foreman_salt/api/v2/salt_minions_controller.rb
foreman_salt-2.0.0 app/controllers/foreman_salt/api/v2/salt_minions_controller.rb