/// <summary>Snippet for DeleteTagBindingAsync</summary> public async Task DeleteTagBindingResourceNamesAsync() { // Snippet: DeleteTagBindingAsync(TagBindingName, CallSettings) // Additional: DeleteTagBindingAsync(TagBindingName, CancellationToken) // Create client TagBindingsClient tagBindingsClient = await TagBindingsClient.CreateAsync(); // Initialize request argument(s) TagBindingName name = TagBindingName.FromTagBinding("[TAG_BINDING]"); // Make the request Operation <Empty, DeleteTagBindingMetadata> response = await tagBindingsClient.DeleteTagBindingAsync(name); // Poll until the returned long-running operation is complete Operation <Empty, DeleteTagBindingMetadata> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result Empty 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 Operation <Empty, DeleteTagBindingMetadata> retrievedResponse = await tagBindingsClient.PollOnceDeleteTagBindingAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result Empty retrievedResult = retrievedResponse.Result; } // End snippet }
/// <summary>Snippet for DeleteTagBinding</summary> public void DeleteTagBinding() { // Snippet: DeleteTagBinding(string, CallSettings) // Create client TagBindingsClient tagBindingsClient = TagBindingsClient.Create(); // Initialize request argument(s) string name = "tagBindings/[TAG_BINDING]"; // Make the request Operation <Empty, DeleteTagBindingMetadata> response = tagBindingsClient.DeleteTagBinding(name); // Poll until the returned long-running operation is complete Operation <Empty, DeleteTagBindingMetadata> completedResponse = response.PollUntilCompleted(); // Retrieve the operation result Empty 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 Operation <Empty, DeleteTagBindingMetadata> retrievedResponse = tagBindingsClient.PollOnceDeleteTagBinding(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result Empty retrievedResult = retrievedResponse.Result; } // End snippet }
/// <summary>Snippet for CreateTagBindingAsync</summary> public async Task CreateTagBindingAsync() { // Snippet: CreateTagBindingAsync(TagBinding, CallSettings) // Additional: CreateTagBindingAsync(TagBinding, CancellationToken) // Create client TagBindingsClient tagBindingsClient = await TagBindingsClient.CreateAsync(); // Initialize request argument(s) TagBinding tagBinding = new TagBinding(); // Make the request Operation <TagBinding, CreateTagBindingMetadata> response = await tagBindingsClient.CreateTagBindingAsync(tagBinding); // Poll until the returned long-running operation is complete Operation <TagBinding, CreateTagBindingMetadata> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result TagBinding 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 Operation <TagBinding, CreateTagBindingMetadata> retrievedResponse = await tagBindingsClient.PollOnceCreateTagBindingAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result TagBinding retrievedResult = retrievedResponse.Result; } // End snippet }
/// <summary>Snippet for CreateTagBinding</summary> public void CreateTagBindingRequestObject() { // Snippet: CreateTagBinding(CreateTagBindingRequest, CallSettings) // Create client TagBindingsClient tagBindingsClient = TagBindingsClient.Create(); // Initialize request argument(s) CreateTagBindingRequest request = new CreateTagBindingRequest { TagBinding = new TagBinding(), ValidateOnly = false, }; // Make the request Operation <TagBinding, CreateTagBindingMetadata> response = tagBindingsClient.CreateTagBinding(request); // Poll until the returned long-running operation is complete Operation <TagBinding, CreateTagBindingMetadata> completedResponse = response.PollUntilCompleted(); // Retrieve the operation result TagBinding 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 Operation <TagBinding, CreateTagBindingMetadata> retrievedResponse = tagBindingsClient.PollOnceCreateTagBinding(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result TagBinding retrievedResult = retrievedResponse.Result; } // End snippet }
/// <summary>Snippet for ListTagBindingsAsync</summary> public async Task ListTagBindingsRequestObjectAsync() { // Snippet: ListTagBindingsAsync(ListTagBindingsRequest, CallSettings) // Create client TagBindingsClient tagBindingsClient = await TagBindingsClient.CreateAsync(); // Initialize request argument(s) ListTagBindingsRequest request = new ListTagBindingsRequest { ParentAsResourceName = new UnparsedResourceName("a/wildcard/resource"), }; // Make the request PagedAsyncEnumerable <ListTagBindingsResponse, TagBinding> response = tagBindingsClient.ListTagBindingsAsync(request); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((TagBinding 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((ListTagBindingsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (TagBinding 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 <TagBinding> 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 (TagBinding 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 ListTagBindings</summary> public void ListTagBindingsResourceNames() { // Snippet: ListTagBindings(IResourceName, string, int?, CallSettings) // Create client TagBindingsClient tagBindingsClient = TagBindingsClient.Create(); // Initialize request argument(s) IResourceName parent = new UnparsedResourceName("a/wildcard/resource"); // Make the request PagedEnumerable <ListTagBindingsResponse, TagBinding> response = tagBindingsClient.ListTagBindings(parent); // Iterate over all response items, lazily performing RPCs as required foreach (TagBinding item in response) { // Do something with each item Console.WriteLine(item); } // Or iterate over pages (of server-defined size), performing one RPC per page foreach (ListTagBindingsResponse page in response.AsRawResponses()) { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (TagBinding 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 <TagBinding> singlePage = response.ReadPage(pageSize); // Do something with the page of items Console.WriteLine($"A page of {pageSize} results (unless it's the final page):"); foreach (TagBinding 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 }