Class: JCF::CLI::Commands::CF::ServiceBrokers

Inherits:
JCF::CLI::Command show all
Includes:
JCF::CF
Defined in:
lib/jcf/cli/commands/cf/service_brokers.rb

Instance Method Summary collapse

Methods included from JCF::CF

curl, do_curl, sanitize_url

Methods inherited from JCF::CLI::Command

inherited

Instance Method Details

#call(name: nil, **options) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/jcf/cli/commands/cf/service_brokers.rb', line 17

def call(name: nil, **options)
  if name
    out.puts formatter.format(data: JCF::CF::ServiceBroker.find_by(name: name))
  else
    # [
    #   #<ServiceBroker @name="cdn-broker", @guid="aaaa", @relationships=[]>,
    #   #<ServiceBroker @name="rds-broker", @guid="bbbb", @relationships=[]>
    # ]
    # output = { name: %w[cdn-broker rds-broker], header2: %w[aaaa bbbb]}

    data = ServiceBroker.all(space_guids: options[:space])

    out.puts formatter.format(data: JCF::CF::Base.format(data))
  end
end