Class: TerraformEnterprise::CommandLine::Commands::PoliciesCommand
- Inherits:
-
TerraformEnterprise::CommandLine::Command
- Object
- Thor
- TerraformEnterprise::CommandLine::Command
- TerraformEnterprise::CommandLine::Commands::PoliciesCommand
- Defined in:
- lib/terraform_enterprise/command_line/commands/policies.rb
Constant Summary collapse
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
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/terraform_enterprise/command_line/commands/policies.rb', line 20 def create(name) params = { name: name, organization: [:organization], enforce: [ { path: "#{name}.sentinel", mode: [:mode] } ] } render client.policies.create(params) end |
#delete(id) ⇒ Object
58 59 60 |
# File 'lib/terraform_enterprise/command_line/commands/policies.rb', line 58 def delete(id) render client.policies.delete(id: id) end |
#get(id) ⇒ Object
53 54 55 |
# File 'lib/terraform_enterprise/command_line/commands/policies.rb', line 53 def get(id) render client.policies.get(id:id) end |
#list ⇒ Object
13 14 15 |
# File 'lib/terraform_enterprise/command_line/commands/policies.rb', line 13 def list render client.policies.list(organization: [:organization]) end |
#update(id) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# 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: [:mode] } ] } render client.policies.update(params) end |
#upload(path, policy_id) ⇒ Object
63 64 65 66 67 68 69 70 |
# File 'lib/terraform_enterprise/command_line/commands/policies.rb', line 63 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 |