/// <summary>Snippet for InsertAsync</summary> public async Task InsertAsync() { // Snippet: InsertAsync(string, string, TargetVpnGateway, CallSettings) // Additional: InsertAsync(string, string, TargetVpnGateway, CancellationToken) // Create client TargetVpnGatewaysClient targetVpnGatewaysClient = await TargetVpnGatewaysClient.CreateAsync(); // Initialize request argument(s) string project = ""; string region = ""; TargetVpnGateway targetVpnGatewayResource = new TargetVpnGateway(); // Make the request lro::Operation <Operation, Operation> response = await targetVpnGatewaysClient.InsertAsync(project, region, targetVpnGatewayResource); // 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 targetVpnGatewaysClient.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 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 }
/// <summary>Snippet for AggregatedListAsync</summary> public async Task AggregatedListAsync() { // Snippet: AggregatedListAsync(string, CallSettings) // Additional: AggregatedListAsync(string, CancellationToken) // Create client TargetVpnGatewaysClient targetVpnGatewaysClient = await TargetVpnGatewaysClient.CreateAsync(); // Initialize request argument(s) string project = ""; // Make the request TargetVpnGatewayAggregatedList response = await targetVpnGatewaysClient.AggregatedListAsync(project); // End snippet }
/// <summary>Snippet for GetAsync</summary> public async Task GetAsync() { // Snippet: GetAsync(string, string, string, CallSettings) // Additional: GetAsync(string, string, string, CancellationToken) // Create client TargetVpnGatewaysClient targetVpnGatewaysClient = await TargetVpnGatewaysClient.CreateAsync(); // Initialize request argument(s) string project = ""; string region = ""; string targetVpnGateway = ""; // Make the request TargetVpnGateway response = await targetVpnGatewaysClient.GetAsync(project, region, targetVpnGateway); // End snippet }
/// <summary>Snippet for InsertAsync</summary> public async Task InsertAsync() { // Snippet: InsertAsync(string, string, TargetVpnGateway, CallSettings) // Additional: InsertAsync(string, string, TargetVpnGateway, CancellationToken) // Create client TargetVpnGatewaysClient targetVpnGatewaysClient = await TargetVpnGatewaysClient.CreateAsync(); // Initialize request argument(s) string project = ""; string region = ""; TargetVpnGateway targetVpnGatewayResource = new TargetVpnGateway(); // Make the request Operation response = await targetVpnGatewaysClient.InsertAsync(project, region, targetVpnGatewayResource); // End snippet }
/// <summary>Snippet for ListAsync</summary> public async Task ListAsync() { // Snippet: ListAsync(string, string, string, int?, CallSettings) // Create client TargetVpnGatewaysClient targetVpnGatewaysClient = await TargetVpnGatewaysClient.CreateAsync(); // Initialize request argument(s) string project = ""; string region = ""; // Make the request PagedAsyncEnumerable <TargetVpnGatewayList, TargetVpnGateway> response = targetVpnGatewaysClient.ListAsync(project, region); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((TargetVpnGateway 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((TargetVpnGatewayList page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (TargetVpnGateway 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 <TargetVpnGateway> 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 (TargetVpnGateway 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 }
/// <summary>Snippet for GetAsync</summary> public async Task GetRequestObjectAsync() { // Snippet: GetAsync(GetTargetVpnGatewayRequest, CallSettings) // Additional: GetAsync(GetTargetVpnGatewayRequest, CancellationToken) // Create client TargetVpnGatewaysClient targetVpnGatewaysClient = await TargetVpnGatewaysClient.CreateAsync(); // Initialize request argument(s) GetTargetVpnGatewayRequest request = new GetTargetVpnGatewayRequest { Region = "", Project = "", TargetVpnGateway = "", }; // Make the request TargetVpnGateway response = await targetVpnGatewaysClient.GetAsync(request); // End snippet }
/// <summary>Snippet for InsertAsync</summary> public async Task InsertRequestObjectAsync() { // Snippet: InsertAsync(InsertTargetVpnGatewayRequest, CallSettings) // Additional: InsertAsync(InsertTargetVpnGatewayRequest, CancellationToken) // Create client TargetVpnGatewaysClient targetVpnGatewaysClient = await TargetVpnGatewaysClient.CreateAsync(); // Initialize request argument(s) InsertTargetVpnGatewayRequest request = new InsertTargetVpnGatewayRequest { TargetVpnGatewayResource = new TargetVpnGateway(), RequestId = "", Region = "", Project = "", }; // Make the request Operation response = await targetVpnGatewaysClient.InsertAsync(request); // End snippet }
/// <summary>Snippet for DeleteAsync</summary> public async Task DeleteRequestObjectAsync() { // Snippet: DeleteAsync(DeleteTargetVpnGatewayRequest, CallSettings) // Additional: DeleteAsync(DeleteTargetVpnGatewayRequest, CancellationToken) // Create client TargetVpnGatewaysClient targetVpnGatewaysClient = await TargetVpnGatewaysClient.CreateAsync(); // Initialize request argument(s) DeleteTargetVpnGatewayRequest request = new DeleteTargetVpnGatewayRequest { RequestId = "", Region = "", Project = "", TargetVpnGateway = "", }; // Make the request Operation response = await targetVpnGatewaysClient.DeleteAsync(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>Snippet for DeleteAsync</summary> public async Task DeleteRequestObjectAsync() { // Snippet: DeleteAsync(DeleteTargetVpnGatewayRequest, CallSettings) // Additional: DeleteAsync(DeleteTargetVpnGatewayRequest, CancellationToken) // Create client TargetVpnGatewaysClient targetVpnGatewaysClient = await TargetVpnGatewaysClient.CreateAsync(); // Initialize request argument(s) DeleteTargetVpnGatewayRequest request = new DeleteTargetVpnGatewayRequest { RequestId = "", Region = "", Project = "", TargetVpnGateway = "", }; // Make the request lro::Operation <Operation, Operation> response = await targetVpnGatewaysClient.DeleteAsync(request); // 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 targetVpnGatewaysClient.PollOnceDeleteAsync(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 }