class TerraformEnterprise::CommandLine::Commands::WorkspacesCommand

Constants

ATTR_STR
CMD_STR

Public Instance Methods

create(name) click to toggle source
# File lib/terraform_enterprise/command_line/commands/workspaces.rb, line 26
def create(name)
  params = {
    organization: options[:organization],
    name: name,
    'working-directory' => options[:working_directory] || '',
  }
  if options[:repo] && options[:oauth_token]
    repo = {}
    repo['branch']             = options[:branch] || ''
    repo['identifier']         = options[:repo]
    repo['oauth-token-id']     = options[:oauth_token]
    repo['ingress-submodules'] = options[:ingress_submodules] || false
    params['vcs-repo'] = repo
  end

  params['migration-environment'] = options[:import_legacy_environment] if options[:import_legacy_environment]
  params['terraform_version']     = options[:terraform_version] if options[:terraform_version]
  render client.workspaces.create(params), except:[:permissions, :actions, :environment]
end
delete(name) click to toggle source
# File lib/terraform_enterprise/command_line/commands/workspaces.rb, line 58
def delete(name)
  params = {
    organization: options[:organization],
    workspace: name
  }
  render client.workspaces.delete(params), except:[:permissions, :actions, :environment]
end
get(name) click to toggle source
# File lib/terraform_enterprise/command_line/commands/workspaces.rb, line 48
def get(name)
  params = {
    organization: options[:organization],
    workspace: name
  }
  render client.workspaces.get(params), except:[:permissions, :environment]
end
list() click to toggle source
# File lib/terraform_enterprise/command_line/commands/workspaces.rb, line 13
def list
  render client.workspaces.list(options), except:[:permissions, :actions, :environment, 'created-at']
end
lock(id) click to toggle source
# File lib/terraform_enterprise/command_line/commands/workspaces.rb, line 78
def lock(id)
  render client.workspaces.action(action: :lock, id: id), except:[:permissions, :environment]
end
unlock(id) click to toggle source
# File lib/terraform_enterprise/command_line/commands/workspaces.rb, line 83
def unlock(id)
  render client.workspaces.action(action: :unlock, id: id), except:[:permissions, :environment]
end
update(name) click to toggle source
# File lib/terraform_enterprise/command_line/commands/workspaces.rb, line 71
def update(name)
  params = options
  params[:workspace] = name
  render client.workspaces.update(params), except:[:permissions, :environment]
end