clientForVM returns the API client responsible for the given guest. In group mode it resolves via SourceProfile; in single mode it returns the single client.
(vm *api.VM)
| 124 | // clientForVM returns the API client responsible for the given guest. In group |
| 125 | // mode it resolves via SourceProfile; in single mode it returns the single client. |
| 126 | func (s *cliSession) clientForVM(vm *api.VM) (*api.Client, error) { |
| 127 | if s.group != nil { |
| 128 | pc, exists := s.group.GetClient(vm.SourceProfile) |
| 129 | if !exists || pc == nil { |
| 130 | return nil, fmt.Errorf("no client for profile %q", vm.SourceProfile) |
| 131 | } |
| 132 | |
| 133 | return pc.Client, nil |
| 134 | } |
| 135 | |
| 136 | return s.single, nil |
| 137 | } |
| 138 | |
| 139 | // getTasks returns recent cluster tasks across all profiles. |
| 140 | func (s *cliSession) getTasks(ctx context.Context) ([]*api.ClusterTask, error) { |
no test coverage detected