Azure / service-catalog-cli

See the upstream repository ->
https://github.com/kubernetes-incubator/service-catalog
MIT License
33 stars 14 forks source link

Add svc-cat describe commands #36

Closed carolynvs closed 6 years ago

carolynvs commented 6 years ago

This adds svc-cat describe <noun> commands for each resources. Describe prints detailed information about a resource in a two-column format. It also has a --traverse flag which was moved over from the get commands. In a separate PR, I'll rework traverse to print output according to #22.

Class and plan contained prototypes for what describe should look like. I've moved their original get implementations to a new describe command, and added a get variant that returns a list with a single item.

As long as I was in there, I've cleaned up the errors to:

Closes #28

carolynvs commented 6 years ago

Here's an example of the new help output:

$ svc-cat describe -h
Show details of a specific resource

Usage:
  svc-cat describe [command]

Available Commands:
  bindings    Show details of a specific binding
  brokers     Show details of a specific broker
  classes     Show details of a specific class
  instances   Show details of a specific instance
  plans       Show details of a specific plan

$ svc-cat describe class -h
Show details of a specific class

Usage:
  svc-cat describe class NAME [flags]

Aliases:
  class, classes, cl

Examples:
  svc-cat describe class azure-mysqldb
  svc-cat describe class -uuid 997b8372-8dac-40ac-ae65-758b4a5075a5

Flags:
  -t, --traverse   Whether or not to traverse from plan -> class -> broker
  -u, --uuid       Whether or not to get the class by UUID (the default is by name)
carolynvs commented 6 years ago

Here is some example output:

$ svc-cat describe broker asb
  Name:      asb                                                                                       
  URL:       http://asb-azure-service-broker.asb.svc.cluster.local                                     
  Status:    Ready - Successfully fetched catalog entries from broker @ 2017-11-21 08:40:58 -0600 CST  

$ svc-cat describe class azure-mysqldb
  Name:          azure-mysqldb                         
  Description:   Azure Database for MySQL Service      
  UUID:          997b8372-8dac-40ac-ae65-758b4a5075a5  
  Status:        Active                                
  Tags:          Azure, MySQL, Database              

$ svc-cat describe class --uuid 997b8372-8dac-40ac-ae65-758b4a5075a5
  Name:          azure-mysqldb                         
  Description:   Azure Database for MySQL Service      
  UUID:          997b8372-8dac-40ac-ae65-758b4a5075a5  
  Status:        Active                                
  Tags:          Azure, MySQL, Database   

$ svc-cat describe instance eager-goat-wordpress-mysql-instance
  Name:          eager-goat-wordpress-mysql-instance                                                
  Namespace:     default                                                                            
  Status:        Ready - The instance was provisioned successfully @ 2017-11-21 08:46:38 -0600 CST  
  Class:         azure-mysqldb                                                                      
  Plan:          standard800     

$ svc-cat describe binding eager-goat-wordpress-mysql-binding
  Name:          eager-goat-wordpress-mysql-binding                            
  Namespace:     default                                                       
  Status:        Ready - Injected bind result @ 2017-11-21 08:46:41 -0600 CST  
  Instance:      eager-goat-wordpress-mysql-instance