Sha256: 49189716a933fe25dfcd45ae0687cd6cbdd7d46693df2989fef56ce8bc728207

Contents?: true

Size: 1.23 KB

Versions: 34

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

module Api
  module V2
    class TemplateInvocationsController < ::Api::V2::BaseController

      before_action :find_job_invocation, :only => %w{template_invocations}

      api :GET, '/job_invocations/:job_invocation_id/template_invocations',
          N_('List template invocations belonging to job invocation')
      param_group :search_and_pagination, ::Api::V2::BaseController
      param :job_invocation_id, :identifier, :required => true
      def template_invocations
        @template_invocations = resource_scope.paginate(paginate_options)
        render :layout => 'api/v2/layouts/index_layout'
      end

      def resource_scope
        if params[:action] == 'template_invocations'
          resource_scope_for_template_invocations
        else
          super
        end
      end

      private

      def resource_scope_for_template_invocations
        @job_invocation.template_invocations.search_for(*search_options)
      end

      def find_job_invocation
        @job_invocation = JobInvocation.find(params[:id])
      end

      def action_permission
        case params[:action]
        when 'template_invocations'
          :view
        else
          super
        end
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
foreman_remote_execution-2.0.10 app/controllers/api/v2/template_invocations_controller.rb
foreman_remote_execution-2.0.9 app/controllers/api/v2/template_invocations_controller.rb
foreman_remote_execution-2.0.8 app/controllers/api/v2/template_invocations_controller.rb
foreman_remote_execution-3.0.3 app/controllers/api/v2/template_invocations_controller.rb
foreman_remote_execution-3.0.2 app/controllers/api/v2/template_invocations_controller.rb
foreman_remote_execution-2.0.7 app/controllers/api/v2/template_invocations_controller.rb
foreman_remote_execution-3.0.1 app/controllers/api/v2/template_invocations_controller.rb
foreman_remote_execution-3.0.0 app/controllers/api/v2/template_invocations_controller.rb
foreman_remote_execution-2.0.6 app/controllers/api/v2/template_invocations_controller.rb
foreman_remote_execution-2.0.5 app/controllers/api/v2/template_invocations_controller.rb
foreman_remote_execution-2.0.4 app/controllers/api/v2/template_invocations_controller.rb
foreman_remote_execution-2.0.3 app/controllers/api/v2/template_invocations_controller.rb
foreman_remote_execution-2.0.2 app/controllers/api/v2/template_invocations_controller.rb
foreman_remote_execution-2.0.1 app/controllers/api/v2/template_invocations_controller.rb
foreman_remote_execution-2.0.0 app/controllers/api/v2/template_invocations_controller.rb
foreman_remote_execution-1.8.4 app/controllers/api/v2/template_invocations_controller.rb
foreman_remote_execution-1.8.3 app/controllers/api/v2/template_invocations_controller.rb
foreman_remote_execution-1.8.2 app/controllers/api/v2/template_invocations_controller.rb
foreman_remote_execution-1.8.1 app/controllers/api/v2/template_invocations_controller.rb
foreman_remote_execution-1.8.0 app/controllers/api/v2/template_invocations_controller.rb