code: func parseServicesConfig(raw json.RawMessage) (map[string]rest.Client, error) {
  
  	services := map[string]rest.Client{}
  
  	var arr []json.RawMessage
  	var obj map[string]json.RawMessage
  
  	if err := util.Unmarshal(raw, &arr); err == nil {
  		for _, s := range arr {
  			client, err := rest.New(s)
  			if err != nil {
  				return nil, err
  			}
  			services[client.Service()] = client
  		}
  	} else if util.Unmarshal(raw, &obj) == nil {
  		for k := range obj {
  			client, err := rest.New(obj[k], rest.Name(k))
  			if err != nil {
  				return nil, err
  			}
  			services[client.Service()] = client
  		}
  	} else {
  		// Return error from array decode as that is the default format.
  		return nil, err
  	}
  
  	return services, nil
  }
docs: // parseServicesConfig returns a set of named service clients. The service
  // clients can be specified either as an array or as a map. Some systems (e.g.,
  // Helm) do not have proper support for configuration values nested under
  // arrays, so just support both here.