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

Function NewClient

api/cfnetworking/cfnetv1/client.go:117–138  ·  view source on GitHub ↗

NewClient returns a new CF Networking client.

(config Config)

Source from the content-addressed store, hash-verified

115
116// NewClient returns a new CF Networking client.
117func NewClient(config Config) *Client {
118 userAgent := fmt.Sprintf("%s/%s (%s; %s %s)", config.AppName, config.AppVersion, runtime.Version(), runtime.GOARCH, runtime.GOOS)
119
120 connection := cfnetworking.NewConnection(cfnetworking.Config{
121 DialTimeout: config.DialTimeout,
122 SkipSSLValidation: config.SkipSSLValidation,
123 })
124
125 wrappedConnection := cfnetworking.NewErrorWrapper().Wrap(connection)
126 for _, wrapper := range config.Wrappers {
127 wrappedConnection = wrapper.Wrap(wrappedConnection)
128 }
129
130 client := &Client{
131 connection: wrappedConnection,
132 router: rata.NewRequestGenerator(config.URL, internal.Routes),
133 url: config.URL,
134 userAgent: userAgent,
135 }
136
137 return client
138}

Callers 2

NewNetworkingClientFunction · 0.92
NewTestClientFunction · 0.70

Calls 4

NewConnectionFunction · 0.92
NewErrorWrapperFunction · 0.92
VersionMethod · 0.80
WrapMethod · 0.65

Tested by 1

NewTestClientFunction · 0.56