/// <summary> /// Creates a TargetHttpsProxy resource in the specified project using the data included in the request. /// Documentation https://developers.google.com/compute/v1/reference/targetHttpsProxies/insert /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated Compute service.</param> /// <param name="project">Project ID for this request.</param> /// <param name="body">A valid Compute v1 body.</param> /// <param name="optional">Optional paramaters.</param> /// <returns>OperationResponse</returns> public static Operation Insert(ComputeService service, string project, TargetHttpsProxy body, TargetHttpsProxiesInsertOptionalParms optional = null) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (body == null) { throw new ArgumentNullException("body"); } if (project == null) { throw new ArgumentNullException(project); } // Building the initial request. var request = service.TargetHttpsProxies.Insert(body, project); // Applying optional parameters to the request. request = (TargetHttpsProxiesResource.InsertRequest)SampleHelpers.ApplyOptionalParms(request, optional); // Requesting data. return(request.Execute()); } catch (Exception ex) { throw new Exception("Request TargetHttpsProxies.Insert failed.", ex); } }
/// <summary> /// Creates a TargetHttpsProxy resource in the specified project using the data included in the request. /// Documentation https://developers.google.com/compute/v1/reference/targetHttpsProxies/insert /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated compute service.</param> /// <param name="project">Project ID for this request.</param> /// <param name="body">A valid compute v1 body.</param> /// <returns>OperationResponse</returns> public static Operation Insert(computeService service, string project, TargetHttpsProxy body) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (body == null) { throw new ArgumentNullException("body"); } if (project == null) { throw new ArgumentNullException(project); } // Make the request. return(service.TargetHttpsProxies.Insert(body, project).Execute()); } catch (Exception ex) { throw new Exception("Request TargetHttpsProxies.Insert failed.", ex); } }
/// <summary>Snippet for InsertAsync</summary> public async Task InsertAsync() { // Snippet: InsertAsync(string, string, TargetHttpsProxy, CallSettings) // Additional: InsertAsync(string, string, TargetHttpsProxy, CancellationToken) // Create client RegionTargetHttpsProxiesClient regionTargetHttpsProxiesClient = await RegionTargetHttpsProxiesClient.CreateAsync(); // Initialize request argument(s) string project = ""; string region = ""; TargetHttpsProxy targetHttpsProxyResource = new TargetHttpsProxy(); // Make the request lro::Operation <Operation, Operation> response = await regionTargetHttpsProxiesClient.InsertAsync(project, region, targetHttpsProxyResource); // Poll until the returned long-running operation is complete lro::Operation <Operation, Operation> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result Operation result = completedResponse.Result; // Or get the name of the operation string operationName = response.Name; // This name can be stored, then the long-running operation retrieved later by name lro::Operation <Operation, Operation> retrievedResponse = await regionTargetHttpsProxiesClient.PollOnceInsertAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result Operation retrievedResult = retrievedResponse.Result; } // End snippet }
/// <summary>Snippet for Insert</summary> public void Insert() { // Snippet: Insert(string, TargetHttpsProxy, CallSettings) // Create client TargetHttpsProxiesClient targetHttpsProxiesClient = TargetHttpsProxiesClient.Create(); // Initialize request argument(s) string project = ""; TargetHttpsProxy targetHttpsProxyResource = new TargetHttpsProxy(); // Make the request Operation response = targetHttpsProxiesClient.Insert(project, targetHttpsProxyResource); // End snippet }
/// <summary>Snippet for Get</summary> public void Get() { // Snippet: Get(string, string, CallSettings) // Create client TargetHttpsProxiesClient targetHttpsProxiesClient = TargetHttpsProxiesClient.Create(); // Initialize request argument(s) string project = ""; string targetHttpsProxy = ""; // Make the request TargetHttpsProxy response = targetHttpsProxiesClient.Get(project, targetHttpsProxy); // End snippet }
/// <summary>Snippet for InsertAsync</summary> public async Task InsertAsync() { // Snippet: InsertAsync(string, TargetHttpsProxy, CallSettings) // Additional: InsertAsync(string, TargetHttpsProxy, CancellationToken) // Create client TargetHttpsProxiesClient targetHttpsProxiesClient = await TargetHttpsProxiesClient.CreateAsync(); // Initialize request argument(s) string project = ""; TargetHttpsProxy targetHttpsProxyResource = new TargetHttpsProxy(); // Make the request Operation response = await targetHttpsProxiesClient.InsertAsync(project, targetHttpsProxyResource); // End snippet }
/// <summary>Snippet for GetAsync</summary> public async Task GetAsync() { // Snippet: GetAsync(string, string, CallSettings) // Additional: GetAsync(string, string, CancellationToken) // Create client TargetHttpsProxiesClient targetHttpsProxiesClient = await TargetHttpsProxiesClient.CreateAsync(); // Initialize request argument(s) string project = ""; string targetHttpsProxy = ""; // Make the request TargetHttpsProxy response = await targetHttpsProxiesClient.GetAsync(project, targetHttpsProxy); // End snippet }
/// <summary>Snippet for Get</summary> public void GetRequestObject() { // Snippet: Get(GetTargetHttpsProxyRequest, CallSettings) // Create client TargetHttpsProxiesClient targetHttpsProxiesClient = TargetHttpsProxiesClient.Create(); // Initialize request argument(s) GetTargetHttpsProxyRequest request = new GetTargetHttpsProxyRequest { TargetHttpsProxy = "", Project = "", }; // Make the request TargetHttpsProxy response = targetHttpsProxiesClient.Get(request); // End snippet }
/// <summary>Snippet for GetAsync</summary> public async Task GetRequestObjectAsync() { // Snippet: GetAsync(GetTargetHttpsProxyRequest, CallSettings) // Additional: GetAsync(GetTargetHttpsProxyRequest, CancellationToken) // Create client TargetHttpsProxiesClient targetHttpsProxiesClient = await TargetHttpsProxiesClient.CreateAsync(); // Initialize request argument(s) GetTargetHttpsProxyRequest request = new GetTargetHttpsProxyRequest { TargetHttpsProxy = "", Project = "", }; // Make the request TargetHttpsProxy response = await targetHttpsProxiesClient.GetAsync(request); // End snippet }
public async stt::Task GetRequestObjectAsync() { moq::Mock <RegionTargetHttpsProxies.RegionTargetHttpsProxiesClient> mockGrpcClient = new moq::Mock <RegionTargetHttpsProxies.RegionTargetHttpsProxiesClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClientForRegionOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetRegionTargetHttpsProxyRequest request = new GetRegionTargetHttpsProxyRequest { TargetHttpsProxy = "target_https_proxycf436352", Region = "regionedb20d96", Project = "projectaa6ff846", }; TargetHttpsProxy expectedResponse = new TargetHttpsProxy { Id = 11672635353343658936UL, Kind = "kindf7aa39d9", Name = "name1c9368b0", CreationTimestamp = "creation_timestamp235e59a1", AuthorizationPolicy = "authorization_policyb4cd090a", Region = "regionedb20d96", Fingerprint = "fingerprint009e6052", ProxyBind = false, SslPolicy = "ssl_policybf005a65", ServerTlsPolicy = "server_tls_policyc2b4dc10", SslCertificates = { "ssl_certificates50ceaff5", }, UrlMap = "url_map3ccdbf57", Description = "description2cf9da67", SelfLink = "self_link7e87f12d", QuicOverride = TargetHttpsProxy.Types.QuicOverride.UndefinedQuicOverride, }; mockGrpcClient.Setup(x => x.GetAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <TargetHttpsProxy>(stt::Task.FromResult(expectedResponse), null, null, null, null)); RegionTargetHttpsProxiesClient client = new RegionTargetHttpsProxiesClientImpl(mockGrpcClient.Object, null); TargetHttpsProxy responseCallSettings = await client.GetAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); TargetHttpsProxy responseCancellationToken = await client.GetAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void Get() { moq::Mock <RegionTargetHttpsProxies.RegionTargetHttpsProxiesClient> mockGrpcClient = new moq::Mock <RegionTargetHttpsProxies.RegionTargetHttpsProxiesClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClientForRegionOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetRegionTargetHttpsProxyRequest request = new GetRegionTargetHttpsProxyRequest { TargetHttpsProxy = "target_https_proxycf436352", Region = "regionedb20d96", Project = "projectaa6ff846", }; TargetHttpsProxy expectedResponse = new TargetHttpsProxy { Id = 11672635353343658936UL, Kind = "kindf7aa39d9", Name = "name1c9368b0", CreationTimestamp = "creation_timestamp235e59a1", AuthorizationPolicy = "authorization_policyb4cd090a", Region = "regionedb20d96", Fingerprint = "fingerprint009e6052", ProxyBind = false, SslPolicy = "ssl_policybf005a65", ServerTlsPolicy = "server_tls_policyc2b4dc10", SslCertificates = { "ssl_certificates50ceaff5", }, UrlMap = "url_map3ccdbf57", Description = "description2cf9da67", SelfLink = "self_link7e87f12d", QuicOverride = "quic_override6404d0e0", }; mockGrpcClient.Setup(x => x.Get(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); RegionTargetHttpsProxiesClient client = new RegionTargetHttpsProxiesClientImpl(mockGrpcClient.Object, null); TargetHttpsProxy response = client.Get(request.Project, request.Region, request.TargetHttpsProxy); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }