Sha256: efd6561b60e7d903fa1b4777015d70cd1cdbd96a2850414abb185ac263589e63

Contents?: true

Size: 1.77 KB

Versions: 14

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_group :taxonomies, ::Api::V2::BaseController
            param :description, String, :required => true
            param :services, 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

14 entries across 14 versions & 1 rubygems

Version Path
foreman_acd-0.11.0 app/controllers/foreman_acd/api/v2/app_definitions_controller.rb
foreman_acd-0.10.0 app/controllers/foreman_acd/api/v2/app_definitions_controller.rb
foreman_acd-0.9.7 app/controllers/foreman_acd/api/v2/app_definitions_controller.rb
foreman_acd-0.9.5 app/controllers/foreman_acd/api/v2/app_definitions_controller.rb
foreman_acd-0.9.4 app/controllers/foreman_acd/api/v2/app_definitions_controller.rb
foreman_acd-0.9.3 app/controllers/foreman_acd/api/v2/app_definitions_controller.rb
foreman_acd-0.9.2.3 app/controllers/foreman_acd/api/v2/app_definitions_controller.rb
foreman_acd-0.9.2.2 app/controllers/foreman_acd/api/v2/app_definitions_controller.rb
foreman_acd-0.9.2.1 app/controllers/foreman_acd/api/v2/app_definitions_controller.rb
foreman_acd-0.9.2 app/controllers/foreman_acd/api/v2/app_definitions_controller.rb
foreman_acd-0.9.1 app/controllers/foreman_acd/api/v2/app_definitions_controller.rb
foreman_acd-0.9.0 app/controllers/foreman_acd/api/v2/app_definitions_controller.rb
foreman_acd-0.7.0 app/controllers/foreman_acd/api/v2/app_definitions_controller.rb
foreman_acd-0.6.0 app/controllers/foreman_acd/api/v2/app_definitions_controller.rb