aboutsummaryrefslogtreecommitdiff
path: root/config/routes.rb
blob: ce7b624e310898e91140fb20c88c0dc5f9413382 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
Rails.application.routes.draw do
  root :to => 'mini_environments#index'

  scope :setup do
    get '/', to: 'setup#show', as: 'setup'

    resources :govuk_guix_revisions,
              controller: 'govuk_guix/revisions',
              only: %i[show destroy]

    post 'enqueue_fetch_govuk_guix_revision',
         to: 'govuk_guix/revisions#enqueue_fetch_revision',
         as: 'enqueue_fetch_govuk_guix_revision'

    scope '/backends' do
      resources :terraform_aws,
                as: 'terraform_aws_backends',
                controller: 'backends/terraform_aws',
                only: %i[create new show update destroy] do
        member do
          post 'perform_action'
        end
      end

      resources :terraform_libvirt,
                as: 'terraform_libvirt_backends',
                controller: 'backends/terraform_libvirt',
                only: %i[create new show update destroy] do
        member do
          post 'perform_action'
        end
      end
    end
  end

  resources :que_jobs, only: [] do
    member do
      post 'cancel'
      post 'retry_now'
    end
  end

  get(
    'terraform_states',
    to: 'terraform_http_backend#index',
    as: 'terraform_states'
  )
  scope :terraform_http_backend do
    get(
      '*state_id/history',
      to: 'terraform_http_backend#show_history',
      as: 'terraform_http_backend_show_history'
    )
    get(
      '*state_id/history/*index',
      to: 'terraform_http_backend#show_by_index',
      as: 'terraform_http_backend_show_by_index'
    )

    get(
      '*state_id',
      to: 'terraform_http_backend#show',
      format: false,
      as: 'terraform_http_backend'
    )
    post '*state_id', to: 'terraform_http_backend#create', format: false
    delete '*state_id', to: 'terraform_http_backend#destroy', format: false
  end

  if Rails.env.development?
    mount GovukAdminTemplate::Engine, at: "/style-guide"
  end

  resources :mini_environments, path: '/' do
    post '/', to: 'mini_environments#perform_action', as: 'perform_action'

    member do
      get 'services'
      put 'services'
    end
  end
end