SetTarget targets the Cloud Controller using the client and sets target information in the config based on the response.
(settings TargetSettings)
| 10 | // SetTarget targets the Cloud Controller using the client and sets target |
| 11 | // information in the config based on the response. |
| 12 | func (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. |
| 44 | func (actor Actor) ClearTarget() { |
nothing calls this directly
no test coverage detected