class NetworkOffer
Public Instance Methods
list()
click to toggle source
# File lib/cloudstack-cli/commands/network_offer.rb 8 def list 9 offerings = client.list_network_offerings(options) 10 if offerings.size < 1 11 puts "No offerings found." 12 else 13 case options[:format].to_sym 14 when :yaml 15 puts({network_offers: offerings}.to_yaml) 16 when :json 17 puts JSON.pretty_generate(network_offers: offerings) 18 else 19 table = [%w(Name Display_Text Default? Guest_IP_Type State)] 20 offerings.each do |offer| 21 table << [ 22 offer['name'], 23 offer['displaytext'], 24 offer['isdefault'], 25 offer['guestiptype'], 26 offer['state'], 27 ] 28 end 29 print_table table 30 end 31 end 32 end
show(name)
click to toggle source
# File lib/cloudstack-cli/commands/network_offer.rb 35 def show(name) 36 unless offer = client.list_network_offerings(name: name).first 37 say "Error: No network offering with name '#{name}' found.", :red 38 else 39 table = offer.map do |key, value| 40 if key == "service" 41 [ set_color("services", :yellow), value.map{|s| s["name"]}.join(", ") ] 42 else 43 [ set_color("#{key}", :yellow), "#{value}" ] 44 end 45 end 46 print_table table 47 end 48 end