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

Function NewNetworkingClient

command/v7/shared/new_networking_client.go:12–40  ·  view source on GitHub ↗

NewNetworkingClient creates a new cfnetworking client.

(apiURL string, config command.Config, uaaClient *uaa.Client, ui command.UI)

Source from the content-addressed store, hash-verified

10
11// NewNetworkingClient creates a new cfnetworking client.
12func NewNetworkingClient(apiURL string, config command.Config, uaaClient *uaa.Client, ui command.UI) (*cfnetv1.Client, error) {
13 if apiURL == "" {
14 return nil, translatableerror.CFNetworkingEndpointNotFoundError{}
15 }
16
17 wrappers := []cfnetv1.ConnectionWrapper{}
18
19 verbose, location := config.Verbose()
20 if verbose {
21 wrappers = append(wrappers, wrapper.NewRequestLogger(ui.RequestLoggerTerminalDisplay()))
22 }
23 if location != nil {
24 wrappers = append(wrappers, wrapper.NewRequestLogger(ui.RequestLoggerFileWriter(location)))
25 }
26
27 authWrapper := wrapper.NewUAAAuthentication(uaaClient, config)
28 wrappers = append(wrappers, authWrapper)
29
30 wrappers = append(wrappers, wrapper.NewRetryRequest(config.RequestRetryCount()))
31
32 return cfnetv1.NewClient(cfnetv1.Config{
33 AppName: config.BinaryName(),
34 AppVersion: config.BinaryVersion(),
35 DialTimeout: config.DialTimeout(),
36 SkipSSLValidation: config.SkipSSLValidation(),
37 URL: apiURL,
38 Wrappers: wrappers,
39 }), nil
40}

Callers 4

SetupMethod · 0.92
SetupMethod · 0.92
SetupMethod · 0.92

Calls 12

NewRequestLoggerFunction · 0.92
NewUAAAuthenticationFunction · 0.92
NewRetryRequestFunction · 0.92
NewClientFunction · 0.92
VerboseMethod · 0.65
RequestRetryCountMethod · 0.65
BinaryNameMethod · 0.65
BinaryVersionMethod · 0.65
DialTimeoutMethod · 0.65
SkipSSLValidationMethod · 0.65

Tested by

no test coverage detected