protected ComputeApiClient GetApiClient(string sampleXmlFileName, string expectedRelativeUrl) { var httpClient = GetFakeHttpClientFromSampleFile(sampleXmlFileName, expectedRelativeUrl); var client = new ComputeApiClient(httpClient); return client; }
/// <summary> /// Try to login into the account using the credentials. /// If succeed, it will return the account details. /// </summary> /// <returns> /// The CaaS connection /// </returns> private async Task<ComputeServiceConnection> LoginTask() { ComputeApiClient apiClient = null; if (ParameterSetName == "ApiBaseUri") { WriteWarning("This parameter is obselete and will not work for MCP2.0 commands"); apiClient = new ComputeApiClient(ApiBaseUri); } if (ParameterSetName == "KnownApiUri") apiClient = new ComputeApiClient(Vendor, Region); if (ParameterSetName == "ApiDomainName") { WriteWarning("This parameter is obselete and will not work for MCP2.0 commands"); apiClient = new ComputeApiClient(ApiDomainName); } var newCloudComputeConnection = new ComputeServiceConnection(apiClient); WriteDebug("Trying to login into the CaaS"); await newCloudComputeConnection.ApiClient.LoginAsync(ApiCredentials.GetNetworkCredential()); return newCloudComputeConnection; }
/// <summary> /// Try to login into the account using the credentials. /// If succeed, it will return the account details. /// </summary> /// <returns> /// The CaaS connection /// </returns> private async Task<ComputeServiceConnection> LoginTask() { ComputeApiClient apiClient = null; if (ParameterSetName == "ApiBaseUri") apiClient = new ComputeApiClient(ApiBaseUri); if (ParameterSetName == "KnownApiUri") apiClient = new ComputeApiClient(Vendor, Region); var newCloudComputeConnection = new ComputeServiceConnection(apiClient); WriteDebug("Trying to login into the CaaS"); await newCloudComputeConnection.ApiClient.LoginAsync(ApiCredentials.GetNetworkCredential()); return newCloudComputeConnection; }
/// <summary> Get a mocked API Client, using the call and response collection in <see cref="requestsAndResponses"/>. </summary> /// <returns> The API client. </returns> protected ComputeApiClient GetApiClient() { var httpClient = CreateFakeHttpClient(); var client = new ComputeApiClient(httpClient); return client; }