/// <summary>Snippet for CreateTagBinding</summary> public void CreateTagBinding() { // Snippet: CreateTagBinding(TagBinding, CallSettings) // Create client TagBindingsClient tagBindingsClient = TagBindingsClient.Create(); // Initialize request argument(s) TagBinding tagBinding = new TagBinding(); // Make the request Operation <TagBinding, CreateTagBindingMetadata> response = tagBindingsClient.CreateTagBinding(tagBinding); // 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 DeleteTagBinding</summary> public void DeleteTagBindingResourceNames() { // Snippet: DeleteTagBinding(TagBindingName, CallSettings) // Create client TagBindingsClient tagBindingsClient = TagBindingsClient.Create(); // Initialize request argument(s) TagBindingName name = TagBindingName.FromTagBinding("[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 ListTagBindings</summary> public void ListTagBindingsRequestObject() { // Snippet: ListTagBindings(ListTagBindingsRequest, CallSettings) // Create client TagBindingsClient tagBindingsClient = TagBindingsClient.Create(); // Initialize request argument(s) ListTagBindingsRequest request = new ListTagBindingsRequest { ParentAsResourceName = new UnparsedResourceName("a/wildcard/resource"), }; // Make the request PagedEnumerable <ListTagBindingsResponse, TagBinding> response = tagBindingsClient.ListTagBindings(request); // 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 }