func NewCloudControllerClient(config commands.Config) (*ccv2.CloudControllerClient, error) {
	if config.Target() == "" {
		return nil, NoAPISetError{
			BinaryName: config.BinaryName(),
		}
	}

	client := ccv2.NewCloudControllerClient()
	_, err := client.TargetCF(config.Target(), config.SkipSSLValidation())
	if err != nil {
		return nil, err
	}

	uaaClient := uaa.NewClient(client.TokenEndpoint(), config)
	client.WrapConnection(wrapper.NewUAAAuthentication(uaaClient))
	//Retry Wrapper
	return client, err
}
Beispiel #2
0
func (cmd *ApiCommand) Setup(config commands.Config, ui commands.UI) error {
	cmd.Actor = configactions.NewActor(config, ccv2.NewCloudControllerClient())
	cmd.UI = ui
	cmd.Config = config
	return nil
}