MCPcopy
hub / github.com/cloudfoundry/cli / connectToCF

Function connectToCF

command/v7/shared/new_clients.go:135–159  ·  view source on GitHub ↗
(config command.Config, ui command.UI, ccClient *ccv3.Client, minVersionV3 string)

Source from the content-addressed store, hash-verified

133}
134
135func 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}

Callers 1

Calls 7

MinimumCCAPIVersionCheckFunction · 0.92
TargetMethod · 0.65
BinaryNameMethod · 0.65
TargetCFMethod · 0.65
SkipSSLValidationMethod · 0.65
DialTimeoutMethod · 0.65
APIVersionMethod · 0.65

Tested by

no test coverage detected