/// <summary>Snippet for InsertAsync</summary> public async Task InsertAsync() { // Snippet: InsertAsync(string, string, NetworkEndpointGroup, CallSettings) // Additional: InsertAsync(string, string, NetworkEndpointGroup, CancellationToken) // Create client RegionNetworkEndpointGroupsClient regionNetworkEndpointGroupsClient = await RegionNetworkEndpointGroupsClient.CreateAsync(); // Initialize request argument(s) string project = ""; string region = ""; NetworkEndpointGroup networkEndpointGroupResource = new NetworkEndpointGroup(); // Make the request lro::Operation <Operation, Operation> response = await regionNetworkEndpointGroupsClient.InsertAsync(project, region, networkEndpointGroupResource); // 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 regionNetworkEndpointGroupsClient.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> /// Creates a network endpoint group in the specified project using the parameters that are included in the request. /// </summary> /// <param name="project"> /// Project ID for this request. /// </param> /// <param name="region"> /// The name of the region where you want to create the network endpoint group. It should comply with RFC1035. /// </param> /// <param name="networkEndpointGroupResource"> /// The body resource for this request /// </param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>The RPC response.</returns> public virtual Operation Insert(string project, string region, NetworkEndpointGroup networkEndpointGroupResource, gaxgrpc::CallSettings callSettings = null) => Insert(new InsertRegionNetworkEndpointGroupRequest { NetworkEndpointGroupResource = gax::GaxPreconditions.CheckNotNull(networkEndpointGroupResource, nameof(networkEndpointGroupResource)), Project = gax::GaxPreconditions.CheckNotNullOrEmpty(project, nameof(project)), Region = gax::GaxPreconditions.CheckNotNullOrEmpty(region, nameof(region)), }, callSettings);
/// <summary>Snippet for Insert</summary> public void Insert() { // Snippet: Insert(string, NetworkEndpointGroup, CallSettings) // Create client GlobalNetworkEndpointGroupsClient globalNetworkEndpointGroupsClient = GlobalNetworkEndpointGroupsClient.Create(); // Initialize request argument(s) string project = ""; NetworkEndpointGroup networkEndpointGroupResource = new NetworkEndpointGroup(); // Make the request Operation response = globalNetworkEndpointGroupsClient.Insert(project, networkEndpointGroupResource); // End snippet }
/// <summary>Snippet for Get</summary> public void Get() { // Snippet: Get(string, string, CallSettings) // Create client GlobalNetworkEndpointGroupsClient globalNetworkEndpointGroupsClient = GlobalNetworkEndpointGroupsClient.Create(); // Initialize request argument(s) string project = ""; string networkEndpointGroup = ""; // Make the request NetworkEndpointGroup response = globalNetworkEndpointGroupsClient.Get(project, networkEndpointGroup); // End snippet }
/// <summary>Snippet for InsertAsync</summary> public async Task InsertAsync() { // Snippet: InsertAsync(string, NetworkEndpointGroup, CallSettings) // Additional: InsertAsync(string, NetworkEndpointGroup, CancellationToken) // Create client GlobalNetworkEndpointGroupsClient globalNetworkEndpointGroupsClient = await GlobalNetworkEndpointGroupsClient.CreateAsync(); // Initialize request argument(s) string project = ""; NetworkEndpointGroup networkEndpointGroupResource = new NetworkEndpointGroup(); // Make the request Operation response = await globalNetworkEndpointGroupsClient.InsertAsync(project, networkEndpointGroupResource); // End snippet }
/// <summary>Snippet for GetAsync</summary> public async Task GetAsync() { // Snippet: GetAsync(string, string, CallSettings) // Additional: GetAsync(string, string, CancellationToken) // Create client GlobalNetworkEndpointGroupsClient globalNetworkEndpointGroupsClient = await GlobalNetworkEndpointGroupsClient.CreateAsync(); // Initialize request argument(s) string project = ""; string networkEndpointGroup = ""; // Make the request NetworkEndpointGroup response = await globalNetworkEndpointGroupsClient.GetAsync(project, networkEndpointGroup); // End snippet }
/// <summary>Snippet for Get</summary> public void GetRequestObject() { // Snippet: Get(GetGlobalNetworkEndpointGroupRequest, CallSettings) // Create client GlobalNetworkEndpointGroupsClient globalNetworkEndpointGroupsClient = GlobalNetworkEndpointGroupsClient.Create(); // Initialize request argument(s) GetGlobalNetworkEndpointGroupRequest request = new GetGlobalNetworkEndpointGroupRequest { Project = "", NetworkEndpointGroup = "", }; // Make the request NetworkEndpointGroup response = globalNetworkEndpointGroupsClient.Get(request); // End snippet }
public async stt::Task GetRequestObjectAsync() { moq::Mock <NetworkEndpointGroups.NetworkEndpointGroupsClient> mockGrpcClient = new moq::Mock <NetworkEndpointGroups.NetworkEndpointGroupsClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClientForZoneOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetNetworkEndpointGroupRequest request = new GetNetworkEndpointGroupRequest { Zone = "zone255f4ea8", Project = "projectaa6ff846", NetworkEndpointGroup = "network_endpoint_groupdf1fb34e", }; NetworkEndpointGroup expectedResponse = new NetworkEndpointGroup { Id = 11672635353343658936UL, Kind = "kindf7aa39d9", Name = "name1c9368b0", Size = -1218396681, Zone = "zone255f4ea8", CreationTimestamp = "creation_timestamp235e59a1", CloudRun = new NetworkEndpointGroupCloudRun(), Annotations = { { "key8a0b6e3c", "value60c16320" }, }, NetworkEndpointType = NetworkEndpointGroup.Types.NetworkEndpointType.InternetFqdnPort, Region = "regionedb20d96", Network = "networkd22ce091", Subnetwork = "subnetworkf55bf572", AppEngine = new NetworkEndpointGroupAppEngine(), Description = "description2cf9da67", DefaultPort = 4850952, SelfLink = "self_link7e87f12d", CloudFunction = new NetworkEndpointGroupCloudFunction(), }; mockGrpcClient.Setup(x => x.GetAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <NetworkEndpointGroup>(stt::Task.FromResult(expectedResponse), null, null, null, null)); NetworkEndpointGroupsClient client = new NetworkEndpointGroupsClientImpl(mockGrpcClient.Object, null); NetworkEndpointGroup responseCallSettings = await client.GetAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); NetworkEndpointGroup responseCancellationToken = await client.GetAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void GetRequestObject() { moq::Mock <RegionNetworkEndpointGroups.RegionNetworkEndpointGroupsClient> mockGrpcClient = new moq::Mock <RegionNetworkEndpointGroups.RegionNetworkEndpointGroupsClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClientForRegionOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetRegionNetworkEndpointGroupRequest request = new GetRegionNetworkEndpointGroupRequest { Region = "regionedb20d96", Project = "projectaa6ff846", NetworkEndpointGroup = "network_endpoint_groupdf1fb34e", }; NetworkEndpointGroup expectedResponse = new NetworkEndpointGroup { Id = 11672635353343658936UL, Kind = "kindf7aa39d9", Name = "name1c9368b0", Size = -1218396681, Zone = "zone255f4ea8", CreationTimestamp = "creation_timestamp235e59a1", CloudRun = new NetworkEndpointGroupCloudRun(), Annotations = { { "key8a0b6e3c", "value60c16320" }, }, NetworkEndpointType = "network_endpoint_typecc2da78a", Region = "regionedb20d96", Network = "networkd22ce091", Subnetwork = "subnetworkf55bf572", AppEngine = new NetworkEndpointGroupAppEngine(), Description = "description2cf9da67", DefaultPort = 4850952, SelfLink = "self_link7e87f12d", CloudFunction = new NetworkEndpointGroupCloudFunction(), }; mockGrpcClient.Setup(x => x.Get(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); RegionNetworkEndpointGroupsClient client = new RegionNetworkEndpointGroupsClientImpl(mockGrpcClient.Object, null); NetworkEndpointGroup response = client.Get(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for GetAsync</summary> public async Task GetRequestObjectAsync() { // Snippet: GetAsync(GetGlobalNetworkEndpointGroupRequest, CallSettings) // Additional: GetAsync(GetGlobalNetworkEndpointGroupRequest, CancellationToken) // Create client GlobalNetworkEndpointGroupsClient globalNetworkEndpointGroupsClient = await GlobalNetworkEndpointGroupsClient.CreateAsync(); // Initialize request argument(s) GetGlobalNetworkEndpointGroupRequest request = new GetGlobalNetworkEndpointGroupRequest { Project = "", NetworkEndpointGroup = "", }; // Make the request NetworkEndpointGroup response = await globalNetworkEndpointGroupsClient.GetAsync(request); // End snippet }
/// <summary> /// Creates a network endpoint group in the specified project using the parameters that are included in the request. /// </summary> /// <param name="project"> /// Project ID for this request. /// </param> /// <param name="region"> /// The name of the region where you want to create the network endpoint group. It should comply with RFC1035. /// </param> /// <param name="networkEndpointGroupResource"> /// The body resource for this request /// </param> /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task <Operation> InsertAsync(string project, string region, NetworkEndpointGroup networkEndpointGroupResource, st::CancellationToken cancellationToken) => InsertAsync(project, region, networkEndpointGroupResource, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
/// <summary> /// Creates a network endpoint group in the specified project using the parameters that are included in the request. /// Documentation https://developers.google.com/compute/alpha/reference/networkEndpointGroups/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="zone">The name of the zone where you want to create the network endpoint group. It should comply with RFC1035.</param> /// <param name="body">A valid Compute alpha body.</param> /// <param name="optional">Optional paramaters.</param> /// <returns>OperationResponse</returns> public static Operation Insert(ComputeService service, string project, string zone, NetworkEndpointGroup body, NetworkEndpointGroupsInsertOptionalParms 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); } if (zone == null) { throw new ArgumentNullException(zone); } // Building the initial request. var request = service.NetworkEndpointGroups.Insert(body, project, zone); // Applying optional parameters to the request. request = (NetworkEndpointGroupsResource.InsertRequest)SampleHelpers.ApplyOptionalParms(request, optional); // Requesting data. return(request.Execute()); } catch (Exception ex) { throw new Exception("Request NetworkEndpointGroups.Insert failed.", ex); } }