(config command.Config, ui command.UI, ccClient *ccv3.Client, minVersionV3 string)
| 133 | } |
| 134 | |
| 135 | func connectToCF(config command.Config, ui command.UI, ccClient *ccv3.Client, minVersionV3 string) (*ccv3.Client, error) { |
| 136 | if config.Target() == "" { |
| 137 | return nil, translatableerror.NoAPISetError{ |
| 138 | BinaryName: config.BinaryName(), |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | ccClient.TargetCF(ccv3.TargetSettings{ |
| 143 | URL: config.Target(), |
| 144 | SkipSSLValidation: config.SkipSSLValidation(), |
| 145 | DialTimeout: config.DialTimeout(), |
| 146 | }) |
| 147 | |
| 148 | if minVersionV3 != "" { |
| 149 | err := command.MinimumCCAPIVersionCheck(config.APIVersion(), minVersionV3) |
| 150 | if err != nil { |
| 151 | if _, ok := err.(translatableerror.MinimumCFAPIVersionNotMetError); ok { |
| 152 | return nil, translatableerror.V3V2SwitchError{} |
| 153 | } |
| 154 | return nil, err |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | return ccClient, nil |
| 159 | } |
no test coverage detected