Welcome to mirror list, hosted at ThFree Co, Russian Federation.

applications_controller.rb « clusters « controllers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c4e7fc950f9c3b590da96e84a1a280dabbc4c1bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# frozen_string_literal: true

class Clusters::ApplicationsController < Clusters::BaseController
  before_action :cluster
  before_action :authorize_create_cluster!, only: [:create]

  def create
    Clusters::Applications::CreateService
      .new(@cluster, current_user, create_cluster_application_params)
      .execute(request)

    head :no_content
  rescue Clusters::Applications::CreateService::InvalidApplicationError
    render_404
  rescue StandardError
    head :bad_request
  end

  private

  def cluster
    @cluster ||= clusterable.clusters.find(params[:id]) || render_404
  end

  def create_cluster_application_params
    params.permit(:application, :hostname, :email)
  end
end