private static C4CHttpClient CreateCloudClient(TargetDescription targetDescription)
        {
            IClientFactory factory = new ClientFactory();

            C4CHttpClient cloudClient;

            if (targetDescription.Hostname != string.Empty && targetDescription.Username != string.Empty)
            {
                cloudClient = factory.CreateC4CHttpClient(targetDescription.Hostname, new ConsoleCredentialHandler(targetDescription.Username));
            }
            else if (targetDescription.Hostname == string.Empty && targetDescription.Username == string.Empty)
            {
                ConfigFileHandler configFileHandler = new ConfigFileHandler();

                cloudClient = factory.CreateC4CHttpClient(configFileHandler.Hostname, configFileHandler);
            }
            else
            {
                throw new Exception("Either target username or target hostname missing.");
            }

            return(cloudClient);
        }
Exemplo n.º 2
0
 public C4CHttpClient CreateC4CHttpClient(string hostname, string username, string password)
 {
     return(ClientFactory.CreateC4CHttpClient(hostname, new NetworkCredential(username, password)));
 }
Exemplo n.º 3
0
 public C4CHttpClient CreateC4CHttpClient(string hostname, INetworkCredentialHandler networkCredentialHandler)
 {
     return(ClientFactory.CreateC4CHttpClient(hostname, networkCredentialHandler.GetCredentials()));
 }