Class: Kontena::Plugin::Cloud::Image::Tag::ListCommand

Inherits:
Command
  • Object
show all
Includes:
Cli::Common, Cli::TableGenerator::Helper, Common, Util
Defined in:
lib/kontena/plugin/cloud/image/tag/list_command.rb

Constant Summary

Constants included from CloudCommand

CloudCommand::PLATFORM_NOT_SELECTED_ERROR

Instance Method Summary collapse

Methods included from Common

#default_org, #image_distribution_url, #image_registry_client, #image_registry_url

Methods included from CloudCommand

#verify_current_grid, #verify_current_master, #verify_current_master_token

Instance Method Details

#executeObject



13
14
15
16
17
18
19
20
21
# File 'lib/kontena/plugin/cloud/image/tag/list_command.rb', line 13

def execute
  tags = image_registry_client.get("/repositories/#{name}/tags")['data']
  print_table(tags) do |t|
    t['id'] = "#{name}:#{t['id']}"
    t['pulls'] = t.dig('attributes', 'pulls')
    t['pushs'] = t.dig('attributes', 'pushs')
    t['updated_at'] = time_ago( Time.parse(t.dig('attributes', 'updated-at')).to_i )
  end
end

#fieldsObject



23
24
25
26
27
28
29
30
# File 'lib/kontena/plugin/cloud/image/tag/list_command.rb', line 23

def fields
  {
    'name' => 'id',
    'pulls' => 'pulls',
    'pushes' => 'pushs',
    'updated' => 'updated_at'
  }
end