Class: TerraformEnterprise::CommandLine::PoliciesCommand
- Defined in:
- lib/terraform_enterprise/command_line/commands/policies.rb
Constant Summary collapse
- ATTR_STR =
STRINGS[:policies][:attributes]
- CMD_STR =
STRINGS[:policies][:commands]
Constants included from TerraformEnterprise::CommandLine
Instance Method Summary collapse
- #create(name) ⇒ Object
- #delete(id) ⇒ Object
- #get(id) ⇒ Object
- #list ⇒ Object
- #update(id) ⇒ Object
- #upload(path, policy_id) ⇒ Object
Methods included from Util::Tar
Instance Method Details
#create(name) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/terraform_enterprise/command_line/commands/policies.rb', line 19 def create(name) params = { name: name, organization: [:organization], enforce: [ { path: "#{name}.sentinel", mode: [:mode] } ] } render client.policies.create(params) end |
#delete(id) ⇒ Object
57 58 59 |
# File 'lib/terraform_enterprise/command_line/commands/policies.rb', line 57 def delete(id) render client.policies.delete(id: id) end |
#get(id) ⇒ Object
52 53 54 |
# File 'lib/terraform_enterprise/command_line/commands/policies.rb', line 52 def get(id) render client.policies.get(id:id) end |
#list ⇒ Object
12 13 14 |
# File 'lib/terraform_enterprise/command_line/commands/policies.rb', line 12 def list render client.policies.list(organization: [:organization]) end |
#update(id) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/terraform_enterprise/command_line/commands/policies.rb', line 35 def update(id) name = '' params = { id: id, name: name, enforce: [ { path: 'default.sentinel', mode: [:mode] } ] } render client.policies.update(params) end |
#upload(path, policy_id) ⇒ Object
62 63 64 65 66 67 68 69 |
# File 'lib/terraform_enterprise/command_line/commands/policies.rb', line 62 def upload(path, policy_id) full_path = File.(path) content = File.read(full_path) params = { content: content, id: policy_id } render client.policies.upload(params) end |