class TerraformEnterprise::CommandLine::Commands::PoliciesCommand

Constants

ATTR_STR
CMD_STR

Public Instance Methods

create(name) click to toggle source
# File lib/terraform_enterprise/command_line/commands/policies.rb, line 20
def create(name)
  params = {
    name: name,
    organization: options[:organization],
    enforce: [
      {
        path: "#{name}.sentinel",
        mode: options[:mode]
      }
    ]
  }
  render client.policies.create(params)
end
delete(id) click to toggle source
# File lib/terraform_enterprise/command_line/commands/policies.rb, line 58
def delete(id)
  render client.policies.delete(id: id)
end
get(id) click to toggle source
# File lib/terraform_enterprise/command_line/commands/policies.rb, line 53
def get(id)
  render client.policies.get(id:id)
end
list() click to toggle source
# File lib/terraform_enterprise/command_line/commands/policies.rb, line 13
def list
  render client.policies.list(organization: options[:organization])
end
update(id) click to toggle source
# File lib/terraform_enterprise/command_line/commands/policies.rb, line 36
def update(id)
  name = ''
  params = {
    id: id,
    name: name,
    enforce: [
      {
        path: 'default.sentinel',
        mode: options[:mode]
      }
    ]
  }

  render client.policies.update(params)
end
upload(path, policy_id) click to toggle source
# File lib/terraform_enterprise/command_line/commands/policies.rb, line 63
def upload(path, policy_id)
  full_path = File.expand_path(path)
  content = File.read(full_path)

  params = { content: content, id: policy_id }

  render client.policies.upload(params)
end