Class: Awry::Sm
Instance Method Summary collapse
Instance Method Details
#ls(prefix = nil) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/awry/sm.rb', line 12 def ls(prefix = nil) client.list_secrets.map(&:secret_list).flatten.tap do |secrets| secrets.select! { |s| s.name.start_with?(prefix) } if prefix end.map do |s| [ s.name, s.description, s.created_date, s.primary_region ] end.tap do |list| print_table list.sort end end |
#value(secret_id) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/awry/sm.rb', line 24 def value(secret_id) string = client.get_secret_value(secret_id: secret_id).secret_string hash = JSON.parse(string) hash.each { |k,v| hash[k] = "#{v.bytesize} bytes" } unless [:show] print_table hash.sort end |