public void AggregatedList() { moq::Mock <TargetVpnGateways.TargetVpnGatewaysClient> mockGrpcClient = new moq::Mock <TargetVpnGateways.TargetVpnGatewaysClient>(moq::MockBehavior.Strict); AggregatedListTargetVpnGatewaysRequest request = new AggregatedListTargetVpnGatewaysRequest { Project = "projectaa6ff846", }; TargetVpnGatewayAggregatedList expectedResponse = new TargetVpnGatewayAggregatedList { Id = "id74b70bb8", Kind = "kindf7aa39d9", Warning = new Warning(), NextPageToken = "next_page_tokendbee0940", Items = { { "key8a0b6e3c", new TargetVpnGatewaysScopedList() }, }, Unreachables = { "unreachables3ca950ee", }, SelfLink = "self_link7e87f12d", }; mockGrpcClient.Setup(x => x.AggregatedList(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); TargetVpnGatewaysClient client = new TargetVpnGatewaysClientImpl(mockGrpcClient.Object, null); TargetVpnGatewayAggregatedList response = client.AggregatedList(request.Project); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for AggregatedListAsync</summary> public async Task AggregatedListRequestObjectAsync() { // Snippet: AggregatedListAsync(AggregatedListTargetVpnGatewaysRequest, CallSettings) // Create client TargetVpnGatewaysClient targetVpnGatewaysClient = await TargetVpnGatewaysClient.CreateAsync(); // Initialize request argument(s) AggregatedListTargetVpnGatewaysRequest request = new AggregatedListTargetVpnGatewaysRequest { OrderBy = "", Project = "", Filter = "", IncludeAllScopes = false, ReturnPartialSuccess = false, }; // Make the request PagedAsyncEnumerable <TargetVpnGatewayAggregatedList, KeyValuePair <string, TargetVpnGatewaysScopedList> > response = targetVpnGatewaysClient.AggregatedListAsync(request); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((KeyValuePair <string, TargetVpnGatewaysScopedList> item) => { // Do something with each item Console.WriteLine(item); }); // Or iterate over pages (of server-defined size), performing one RPC per page await response.AsRawResponses().ForEachAsync((TargetVpnGatewayAggregatedList page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (KeyValuePair <string, TargetVpnGatewaysScopedList> item in page) { // Do something with each item Console.WriteLine(item); } }); // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required int pageSize = 10; Page <KeyValuePair <string, TargetVpnGatewaysScopedList> > singlePage = await response.ReadPageAsync(pageSize); // Do something with the page of items Console.WriteLine($"A page of {pageSize} results (unless it's the final page):"); foreach (KeyValuePair <string, TargetVpnGatewaysScopedList> item in singlePage) { // Do something with each item Console.WriteLine(item); } // Store the pageToken, for when the next page is required. string nextPageToken = singlePage.NextPageToken; // End snippet }
public async stt::Task AggregatedListRequestObjectAsync() { moq::Mock <TargetVpnGateways.TargetVpnGatewaysClient> mockGrpcClient = new moq::Mock <TargetVpnGateways.TargetVpnGatewaysClient>(moq::MockBehavior.Strict); AggregatedListTargetVpnGatewaysRequest request = new AggregatedListTargetVpnGatewaysRequest { PageToken = "page_tokenf09e5538", MaxResults = 2806814450U, OrderBy = "order_byb4d33ada", Project = "projectaa6ff846", Filter = "filtere47ac9b2", IncludeAllScopes = false, ReturnPartialSuccess = false, }; TargetVpnGatewayAggregatedList expectedResponse = new TargetVpnGatewayAggregatedList { Id = "id74b70bb8", Kind = "kindf7aa39d9", Warning = new Warning(), NextPageToken = "next_page_tokendbee0940", Items = { { "key8a0b6e3c", new TargetVpnGatewaysScopedList() }, }, Unreachables = { "unreachables3ca950ee", }, SelfLink = "self_link7e87f12d", }; mockGrpcClient.Setup(x => x.AggregatedListAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <TargetVpnGatewayAggregatedList>(stt::Task.FromResult(expectedResponse), null, null, null, null)); TargetVpnGatewaysClient client = new TargetVpnGatewaysClientImpl(mockGrpcClient.Object, null); TargetVpnGatewayAggregatedList responseCallSettings = await client.AggregatedListAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); TargetVpnGatewayAggregatedList responseCancellationToken = await client.AggregatedListAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for AggregatedList</summary> public void AggregatedListRequestObject() { // Snippet: AggregatedList(AggregatedListTargetVpnGatewaysRequest, CallSettings) // Create client TargetVpnGatewaysClient targetVpnGatewaysClient = TargetVpnGatewaysClient.Create(); // Initialize request argument(s) AggregatedListTargetVpnGatewaysRequest request = new AggregatedListTargetVpnGatewaysRequest { PageToken = "", MaxResults = 0U, OrderBy = "", Project = "", Filter = "", IncludeAllScopes = false, ReturnPartialSuccess = false, }; // Make the request TargetVpnGatewayAggregatedList response = targetVpnGatewaysClient.AggregatedList(request); // End snippet }
/// <summary>Snippet for AggregatedListAsync</summary> public async Task AggregatedListRequestObjectAsync() { // Snippet: AggregatedListAsync(AggregatedListTargetVpnGatewaysRequest, CallSettings) // Additional: AggregatedListAsync(AggregatedListTargetVpnGatewaysRequest, CancellationToken) // Create client TargetVpnGatewaysClient targetVpnGatewaysClient = await TargetVpnGatewaysClient.CreateAsync(); // Initialize request argument(s) AggregatedListTargetVpnGatewaysRequest request = new AggregatedListTargetVpnGatewaysRequest { PageToken = "", MaxResults = 0U, OrderBy = "", Project = "", Filter = "", IncludeAllScopes = false, ReturnPartialSuccess = false, }; // Make the request TargetVpnGatewayAggregatedList response = await targetVpnGatewaysClient.AggregatedListAsync(request); // End snippet }
/// <summary> /// Retrieves an aggregated list of target VPN gateways. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public override stt::Task <TargetVpnGatewayAggregatedList> AggregatedListAsync(AggregatedListTargetVpnGatewaysRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_AggregatedListTargetVpnGatewaysRequest(ref request, ref callSettings); return(_callAggregatedList.Async(request, callSettings)); }
partial void Modify_AggregatedListTargetVpnGatewaysRequest(ref AggregatedListTargetVpnGatewaysRequest request, ref gaxgrpc::CallSettings settings);
/// <summary> /// Retrieves an aggregated list of target VPN gateways. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</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 <TargetVpnGatewayAggregatedList> AggregatedListAsync(AggregatedListTargetVpnGatewaysRequest request, st::CancellationToken cancellationToken) => AggregatedListAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
/// <summary> /// Retrieves an aggregated list of target VPN gateways. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task <TargetVpnGatewayAggregatedList> AggregatedListAsync(AggregatedListTargetVpnGatewaysRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();