Class: TerraformEnterprise::CommandLine::Commands::VariablesCommand

Inherits:
TerraformEnterprise::CommandLine::Command show all
Defined in:
lib/terraform_enterprise/command_line/commands/variables.rb

Constant Summary collapse

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

Constants included from TerraformEnterprise::CommandLine

STRINGS, VERSION

Instance Method Summary collapse

Methods included from Util::Tar

#gzip, #tar, #tarball

Instance Method Details

#create(key, value) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/terraform_enterprise/command_line/commands/variables.rb', line 24

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



57
58
59
# File 'lib/terraform_enterprise/command_line/commands/variables.rb', line 57

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

#get(id) ⇒ Object



52
53
54
# File 'lib/terraform_enterprise/command_line/commands/variables.rb', line 52

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

#listObject



14
15
16
# File 'lib/terraform_enterprise/command_line/commands/variables.rb', line 14

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

#update(id) ⇒ Object



42
43
44
45
46
47
48
49
# File 'lib/terraform_enterprise/command_line/commands/variables.rb', line 42

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