Class: TerraformEnterprise::CommandLine::Commands::MainCommand
- Inherits:
-
TerraformEnterprise::CommandLine::Command
- Object
- Thor
- TerraformEnterprise::CommandLine::Command
- TerraformEnterprise::CommandLine::Commands::MainCommand
- Defined in:
- lib/terraform_enterprise/command_line/commands/main.rb
Overview
Terraform Enterprise Command Line class
Constant Summary
Constants inherited from TerraformEnterprise::CommandLine::Command
TerraformEnterprise::CommandLine::Command::CMD_STR
Constants included from TerraformEnterprise::CommandLine
Instance Method Summary collapse
Methods included from Util::Tar
Instance Method Details
#push(name) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/terraform_enterprise/command_line/commands/main.rb', line 50 def push(name) name_parts = name.split('/') organization_name = name_parts[0] workspace_name = name_parts[1] workspace_params = { organization: organization_name, workspace: workspace_name } begin content = tarball([:path]) rescue error! "could not open that file or directory" end # Look up the workspace ID workspace_response = client.workspaces.get(workspace_params) workspace_id = workspace_response&.resource&.id error! "workspace '#{organization_name}/#{workspace_name}' was not found!" unless workspace_id # Create a configuration version and get upload-url configuration_version_response = client.configuration_versions.create(workspace: workspace_id) upload_url = (configuration_version_response&.resource&.attributes || {})['upload-url'] error! "failed creationg configuration version with workspace id `#{workspace_id}`" unless upload_url upload_params = { content: content, url: upload_url } render client.configuration_versions.upload(upload_params) end |
#version ⇒ Object
80 81 82 |
# File 'lib/terraform_enterprise/command_line/commands/main.rb', line 80 def version puts "Terraform Enterprise CLI #{TerraformEnterprise::CommandLine::VERSION}" end |