Class: TerraformEnterprise::Commands::VariablesCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/terraform-enterprise/commands/variables_command.rb

Constant Summary collapse

ATTR_STR =
STRINGS[:variables][:attributes]
CMD_STR =
STRINGS[:variables][:commands]

Instance Method Summary collapse

Instance Method Details

#create(key, value) ⇒ Object



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

def create(key, value)
  params = {
    category: options[:category],
    hcl: options[:hcl],
    key: key,
    organization: options[:organization],
    sensitive: options[:sensitive],
    value: value,
    workspace: options[:workspace],
  }
  render client.variables.create(params)
end

#delete(id) ⇒ Object



56
57
58
# File 'lib/terraform-enterprise/commands/variables_command.rb', line 56

def delete(id)
  render client.variables.delete(id: id)
end

#get(id) ⇒ Object



51
52
53
# File 'lib/terraform-enterprise/commands/variables_command.rb', line 51

def get(id)
  render client.variables.get(id:id)
end

#listObject



13
14
15
# File 'lib/terraform-enterprise/commands/variables_command.rb', line 13

def list
  render client.variables.list(options)
end

#update(id) ⇒ Object



41
42
43
44
45
46
47
48
# File 'lib/terraform-enterprise/commands/variables_command.rb', line 41

def update(id)
  params             = {id: id}
  params[:hcl]       = options[:hcl] if options.include?('hcl')
  params[:key]       = options[:key] if options[:key]
  params[:sensitive] = options[:sensitive] if options.include?('sensitive')
  params[:value]     = options[:value] if options[:value]
  render client.variables.update(params)
end