Sha256: 9d6438c82273c99dc9a1484f9e7945e45f4d0e6016bdc6700388388cab1736bf

Contents?: true

Size: 1.77 KB

Versions: 6

Compression:

Stored size: 1.77 KB

Contents

# frozen_string_literal: true

module ForemanAcd
  module Api
    module V2
      # API controller for App Definitions
      class AppDefinitionsController < ::ForemanAcd::Api::V2::BaseController
        include ::ForemanAcd::Concerns::AppDefinitionParameters

        before_action :find_resource, :except => [:index, :create]

        api :GET, '/app_definitions/:id', N_('Show application definition')
        param :id, :identifier, :required => true
        def show; end

        api :GET, '/app_definitions', N_('List application definitions')
        param_group :search_and_pagination, ::Api::V2::BaseController
        add_scoped_search_description_for(AppDefinition)
        def index
          @app_definitions = resource_scope_for_index
        end

        def_param_group :app_definition do
          param :app_definition, Hash, :required => true, :action_aware => true do
            param :name, String, :required => true
            param :description, String, :required => true
            param :hostgroup_id, :number, :required => true
            param :parameters, String, :required => true
          end
        end

        api :POST, '/app_definitions', N_('Create a application definition')
        param_group :app_definition, :as => :create
        def create
          @app_definition = AppDefinition.new(app_definition_params)
          process_response @app_definition.save
        end

        api :DELETE, '/app_definitions/:id', N_('Deletes application definition')
        param :id, :identifier, :required => true
        def destroy
          process_response @app_definition.destroy
        end

        def controller_permission
          'app_definitions'
        end

        def resource_class
          ForemanAcd::AppDefinition
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
foreman_acd-0.0.6 app/controllers/foreman_acd/api/v2/app_definitions_controller.rb
foreman_acd-0.0.5 app/controllers/foreman_acd/api/v2/app_definitions_controller.rb
foreman_acd-0.0.4 app/controllers/foreman_acd/api/v2/app_definitions_controller.rb
foreman_acd-0.0.3 app/controllers/foreman_acd/api/v2/app_definitions_controller.rb
foreman_acd-0.0.2 app/controllers/foreman_acd/api/v2/app_definitions_controller.rb
foreman_acd-0.0.1 app/controllers/foreman_acd/api/v2/app_definitions_controller.rb