public VSphereVMController(string address, NetworkCredential credential) { if (credential == null) { throw new ArgumentNullException(nameof(credential)); } _vSphereClient = new Lazy <VSphereClient>(() => { VSphereClient client = new VSphereClient(address); client.Connect(credential); return(client); }); }
/// <summary> /// Initializes a new instance of the <see cref="VSphereVMController" /> class. /// </summary> /// <param name="serverUri">The server URI for the vSphere server.</param> /// <param name="credential">The <see cref="NetworkCredential" /> to use to connect to vSphere.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="serverUri" /> is null. /// <para>or</para> /// <paramref name="credential" /> is null. /// </exception> public VSphereVMController(Uri serverUri, NetworkCredential credential) { if (serverUri == null) { throw new ArgumentNullException(nameof(serverUri)); } if (credential == null) { throw new ArgumentNullException(nameof(credential)); } _vSphereClient = new Lazy <VSphereClient>(() => { VSphereClient client = new VSphereClient(serverUri); client.Connect(credential); return(client); }); }