MCPcopy Index your code
hub / github.com/cloudfoundry/cli / SetTarget

Method SetTarget

actor/v7action/target.go:12–41  ·  view source on GitHub ↗

SetTarget targets the Cloud Controller using the client and sets target information in the config based on the response.

(settings TargetSettings)

Source from the content-addressed store, hash-verified

10// SetTarget targets the Cloud Controller using the client and sets target
11// information in the config based on the response.
12func (actor Actor) SetTarget(settings TargetSettings) (Warnings, error) {
13 var allWarnings Warnings
14
15 actor.CloudControllerClient.TargetCF(ccv3.TargetSettings(settings))
16
17 rootInfo, warnings, err := actor.CloudControllerClient.GetRoot()
18 allWarnings = append(allWarnings, warnings...)
19 if err != nil {
20 return allWarnings, err
21 }
22
23 actor.Config.SetTargetInformation(configv3.TargetInformationArgs{
24 Api: settings.URL,
25 ApiVersion: rootInfo.CloudControllerAPIVersion(),
26 Auth: rootInfo.Login(),
27 MinCLIVersion: "", // Oldest supported V3 version should be OK
28 Doppler: rootInfo.Logging(),
29 LogCache: rootInfo.LogCache(),
30 NetworkPolicyV1: rootInfo.NetworkPolicyV1(),
31 Routing: rootInfo.Routing(),
32 SkipSSLValidation: settings.SkipSSLValidation,
33 UAA: rootInfo.UAA(),
34 CFOnK8s: rootInfo.CFOnK8s,
35 })
36
37 actor.Config.SetTokenInformation("", "", "")
38 actor.Config.SetKubernetesAuthInfo("")
39
40 return allWarnings, nil
41}
42
43// ClearTarget clears target information from the config.
44func (actor Actor) ClearTarget() {

Callers

nothing calls this directly

Implementers 1

FakeActorcommand/v7/v7fakes/fake_actor.go

Calls 13

TargetSettingsStruct · 0.92
LoginMethod · 0.80
LoggingMethod · 0.80
LogCacheMethod · 0.80
NetworkPolicyV1Method · 0.80
RoutingMethod · 0.80
UAAMethod · 0.80
TargetCFMethod · 0.65
GetRootMethod · 0.65
SetTargetInformationMethod · 0.65
SetTokenInformationMethod · 0.65

Tested by

no test coverage detected