Class: TerraformEnterprise::API::Workspaces

Inherits:
ResourceRequest show all
Defined in:
lib/terraform-enterprise/resource_requests/workspaces.rb

Instance Method Summary collapse

Methods inherited from ResourceRequest

#initialize

Constructor Details

This class inherits a constructor from TerraformEnterprise::API::ResourceRequest

Instance Method Details

#action(params = {}) ⇒ Object



40
41
42
# File 'lib/terraform-enterprise/resource_requests/workspaces.rb', line 40

def action(params={})
  @request.post(:workspaces, params[:id], :actions, params[:action].to_sym)
end

#create(params = {}) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/terraform-enterprise/resource_requests/workspaces.rb', line 14

def create(params={})
  org = params.delete(:organization)
  data = {
    attributes: params,
    type: 'workspaces'
  }

  @request.post(:organizations, org, :workspaces, data: data)
end

#delete(params = {}) ⇒ Object



36
37
38
# File 'lib/terraform-enterprise/resource_requests/workspaces.rb', line 36

def delete(params={})
  @request.delete(:organizations, params[:organization], :workspaces, params[:workspace])
end

#get(params = {}) ⇒ Object



10
11
12
# File 'lib/terraform-enterprise/resource_requests/workspaces.rb', line 10

def get(params={})
  @request.get(:organizations, params[:organization], :workspaces, params[:workspace])
end

#list(params = {}) ⇒ Object



6
7
8
# File 'lib/terraform-enterprise/resource_requests/workspaces.rb', line 6

def list(params={})
  @request.get(:organizations, params[:organization], :workspaces)
end

#update(params = {}) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/terraform-enterprise/resource_requests/workspaces.rb', line 24

def update(params={})
  org = params.delete(:organization)
  id  = params.delete(:workspace)

  data = {
    attributes: params,
    type: 'workspaces'
  }

  @request.patch(:organizations, org, :workspaces, id, data: data)
end