Sha256: 846f349077e96fd2f8e2a348cdde095230ee3e06bfe33d32a6df5ed30fae4729
Contents?: true
Size: 956 Bytes
Versions: 25
Compression:
Stored size: 956 Bytes
Contents
class Job < CloudstackCli::Base desc 'list', 'list async jobs' option :format, default: "table", enum: %w(table json yaml) def list jobs = client.list_async_jobs if jobs.size < 1 say "No jobs found." else case options[:format].to_sym when :yaml puts({jobs: jobs}.to_yaml) when :json puts JSON.pretty_generate(jobs: jobs) else table = [%w(Command Created Status ID User-ID)] jobs.each do |job| table << [ job['cmd'].split('.')[-1], job['created'], job['jobstatus'], job['jobid'], job['userid'] ] end print_table table end end end desc 'query ID', 'query async job' def query(id) job = client.query_async_job_result(jobid: id) table = job.map do |key, value| [ set_color("#{key}:", :yellow), "#{value}" ] end print_table table end end
Version data entries
25 entries across 25 versions & 1 rubygems