summaryrefslogtreecommitdiff
path: root/lib/api/terraform/state.rb
blob: 7e55dfedfeb5666b4be4265eb9f21aa3bf646471 (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
# frozen_string_literal: true

module API
  module Terraform
    class State < Grape::API
      before { authenticate! }
      before { authorize! :admin_terraform_state, user_project }

      params do
        requires :id, type: String, desc: 'The ID of a project'
      end
      resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
        params do
          requires :name, type: String, desc: 'The name of a terraform state'
        end
        namespace ':id/terraform/state/:name' do
          desc 'Get a terraform state by its name'
          route_setting :authentication, basic_auth_personal_access_token: true
          get do
            status 501
            content_type 'text/plain'
            body 'not implemented'
          end

          desc 'Add a new terraform state or update an existing one'
          route_setting :authentication, basic_auth_personal_access_token: true
          post do
            status 501
            content_type 'text/plain'
            body 'not implemented'
          end

          desc 'Delete a terraform state of certain name'
          route_setting :authentication, basic_auth_personal_access_token: true
          delete do
            status 501
            content_type 'text/plain'
            body 'not implemented'
          end
        end
      end
    end
  end
end