Class: Awful::DataPipeline
Instance Method Summary collapse
Methods inherited from Cli
Constructor Details
This class inherits a constructor from Awful::Cli
Instance Method Details
#ls(name = /./) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/awful/datapipeline.rb', line 8 def ls(name = /./) dps = datapipeline.list_pipelines.pipeline_id_list.select do |dp| dp.name.match(name) end if [:long] datapipeline.describe_pipelines(pipeline_ids: dps.map(&:id)).pipeline_description_list.map do |dp| dp.fields.each_with_object({}) do |f, h| h[f.key] = f.string_value # convert array of structs to hash end.merge('id' => dp.pipeline_id) end.tap do |list| print_table list.map { |d| d.values_at('@creationTime', 'id', '@pipelineState', '@healthStatus', 'name') }.sort end else puts dps.map(&:name).sort end end |