Sha256: 795ea3c3d263d957ab3d6973e4ff10f2cf63b7123b75788a249ae16ab9467208

Contents?: true

Size: 1.48 KB

Versions: 12

Compression:

Stored size: 1.48 KB

Contents

module ForemanSalt
  module Api
    module V2
      class SaltEnvironmentsController < ::ForemanSalt::Api::V2::BaseController
        include ::ForemanSalt::Concerns::SaltEnvironmentParameters

        before_action :find_resource, except: %i[index create]

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

        api :GET, '/salt_environments/:id/', N_('Show a Salt environment')
        param :id, :identifier_dottable, required: true
        def show
        end

        def_param_group :environment do
          param :environment, Hash, required: true, action_aware: true do
            param :name, String, required: true
          end
        end

        api :POST, '/salt_environments', N_('Create a Salt environment')
        param_group :environment, as: :create
        def create
          @salt_environment = SaltEnvironment.new(salt_environment_params)
          process_response @salt_environment.save
        end

        api :DELETE, '/salt_environments/:id/', N_('Destroy a Salt environment')
        param :id, :identifier, required: true
        def destroy
          process_response @salt_environment.destroy
        end

        def controller_permission
          'salt_environments'
        end

        def resource_class
          ForemanSalt::SaltEnvironment
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
foreman_salt-17.0.0 app/controllers/foreman_salt/api/v2/salt_environments_controller.rb
foreman_salt-16.0.3 app/controllers/foreman_salt/api/v2/salt_environments_controller.rb
foreman_salt-16.0.2 app/controllers/foreman_salt/api/v2/salt_environments_controller.rb
foreman_salt-16.0.1 app/controllers/foreman_salt/api/v2/salt_environments_controller.rb
foreman_salt-16.0.0 app/controllers/foreman_salt/api/v2/salt_environments_controller.rb
foreman_salt-15.2.3 app/controllers/foreman_salt/api/v2/salt_environments_controller.rb
foreman_salt-15.2.2 app/controllers/foreman_salt/api/v2/salt_environments_controller.rb
foreman_salt-15.2.1 app/controllers/foreman_salt/api/v2/salt_environments_controller.rb
foreman_salt-15.2.0 app/controllers/foreman_salt/api/v2/salt_environments_controller.rb
foreman_salt-15.1.0 app/controllers/foreman_salt/api/v2/salt_environments_controller.rb
foreman_salt-15.0.0 app/controllers/foreman_salt/api/v2/salt_environments_controller.rb
foreman_salt-14.1.0 app/controllers/foreman_salt/api/v2/salt_environments_controller.rb