Ejemplo n.º 1
0
        /// <summary>Snippet for PatchAsync</summary>
        public async Task PatchAsync()
        {
            // Snippet: PatchAsync(string, string, PublicAdvertisedPrefix, CallSettings)
            // Additional: PatchAsync(string, string, PublicAdvertisedPrefix, CancellationToken)
            // Create client
            PublicAdvertisedPrefixesClient publicAdvertisedPrefixesClient = await PublicAdvertisedPrefixesClient.CreateAsync();

            // Initialize request argument(s)
            string project = "";
            string publicAdvertisedPrefix = "";
            PublicAdvertisedPrefix publicAdvertisedPrefixResource = new PublicAdvertisedPrefix();
            // Make the request
            lro::Operation <Operation, Operation> response = await publicAdvertisedPrefixesClient.PatchAsync(project, publicAdvertisedPrefix, publicAdvertisedPrefixResource);

            // 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 publicAdvertisedPrefixesClient.PollOncePatchAsync(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 ListAsync</summary>
        public async Task ListRequestObjectAsync()
        {
            // Snippet: ListAsync(ListPublicAdvertisedPrefixesRequest, CallSettings)
            // Create client
            PublicAdvertisedPrefixesClient publicAdvertisedPrefixesClient = await PublicAdvertisedPrefixesClient.CreateAsync();

            // Initialize request argument(s)
            ListPublicAdvertisedPrefixesRequest request = new ListPublicAdvertisedPrefixesRequest
            {
                OrderBy = "",
                Project = "",
                Filter  = "",
                ReturnPartialSuccess = false,
            };
            // Make the request
            PagedAsyncEnumerable <PublicAdvertisedPrefixList, PublicAdvertisedPrefix> response = publicAdvertisedPrefixesClient.ListAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((PublicAdvertisedPrefix 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((PublicAdvertisedPrefixList page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (PublicAdvertisedPrefix 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 <PublicAdvertisedPrefix> 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 (PublicAdvertisedPrefix 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
        }
Ejemplo n.º 3
0
        /// <summary>Snippet for ListAsync</summary>
        public async Task ListAsync()
        {
            // Snippet: ListAsync(string, CallSettings)
            // Additional: ListAsync(string, CancellationToken)
            // Create client
            PublicAdvertisedPrefixesClient publicAdvertisedPrefixesClient = await PublicAdvertisedPrefixesClient.CreateAsync();

            // Initialize request argument(s)
            string project = "";
            // Make the request
            PublicAdvertisedPrefixList response = await publicAdvertisedPrefixesClient.ListAsync(project);

            // End snippet
        }
        /// <summary>Snippet for InsertAsync</summary>
        public async Task InsertAsync()
        {
            // Snippet: InsertAsync(string, PublicAdvertisedPrefix, CallSettings)
            // Additional: InsertAsync(string, PublicAdvertisedPrefix, CancellationToken)
            // Create client
            PublicAdvertisedPrefixesClient publicAdvertisedPrefixesClient = await PublicAdvertisedPrefixesClient.CreateAsync();

            // Initialize request argument(s)
            string project = "";
            PublicAdvertisedPrefix publicAdvertisedPrefixResource = new PublicAdvertisedPrefix();
            // Make the request
            Operation response = await publicAdvertisedPrefixesClient.InsertAsync(project, publicAdvertisedPrefixResource);

            // End snippet
        }
        /// <summary>Snippet for GetAsync</summary>
        public async Task GetRequestObjectAsync()
        {
            // Snippet: GetAsync(GetPublicAdvertisedPrefixeRequest, CallSettings)
            // Additional: GetAsync(GetPublicAdvertisedPrefixeRequest, CancellationToken)
            // Create client
            PublicAdvertisedPrefixesClient publicAdvertisedPrefixesClient = await PublicAdvertisedPrefixesClient.CreateAsync();

            // Initialize request argument(s)
            GetPublicAdvertisedPrefixeRequest request = new GetPublicAdvertisedPrefixeRequest
            {
                PublicAdvertisedPrefix = "",
                Project = "",
            };
            // Make the request
            PublicAdvertisedPrefix response = await publicAdvertisedPrefixesClient.GetAsync(request);

            // End snippet
        }
        /// <summary>Snippet for DeleteAsync</summary>
        public async Task DeleteRequestObjectAsync()
        {
            // Snippet: DeleteAsync(DeletePublicAdvertisedPrefixeRequest, CallSettings)
            // Additional: DeleteAsync(DeletePublicAdvertisedPrefixeRequest, CancellationToken)
            // Create client
            PublicAdvertisedPrefixesClient publicAdvertisedPrefixesClient = await PublicAdvertisedPrefixesClient.CreateAsync();

            // Initialize request argument(s)
            DeletePublicAdvertisedPrefixeRequest request = new DeletePublicAdvertisedPrefixeRequest
            {
                RequestId = "",
                PublicAdvertisedPrefix = "",
                Project = "",
            };
            // Make the request
            Operation response = await publicAdvertisedPrefixesClient.DeleteAsync(request);

            // End snippet
        }
        /// <summary>Snippet for InsertAsync</summary>
        public async Task InsertRequestObjectAsync()
        {
            // Snippet: InsertAsync(InsertPublicAdvertisedPrefixeRequest, CallSettings)
            // Additional: InsertAsync(InsertPublicAdvertisedPrefixeRequest, CancellationToken)
            // Create client
            PublicAdvertisedPrefixesClient publicAdvertisedPrefixesClient = await PublicAdvertisedPrefixesClient.CreateAsync();

            // Initialize request argument(s)
            InsertPublicAdvertisedPrefixeRequest request = new InsertPublicAdvertisedPrefixeRequest
            {
                RequestId = "",
                Project   = "",
                PublicAdvertisedPrefixResource = new PublicAdvertisedPrefix(),
            };
            // Make the request
            Operation response = await publicAdvertisedPrefixesClient.InsertAsync(request);

            // End snippet
        }
Ejemplo n.º 8
0
        /// <summary>Snippet for ListAsync</summary>
        public async Task ListRequestObjectAsync()
        {
            // Snippet: ListAsync(ListPublicAdvertisedPrefixesRequest, CallSettings)
            // Additional: ListAsync(ListPublicAdvertisedPrefixesRequest, CancellationToken)
            // Create client
            PublicAdvertisedPrefixesClient publicAdvertisedPrefixesClient = await PublicAdvertisedPrefixesClient.CreateAsync();

            // Initialize request argument(s)
            ListPublicAdvertisedPrefixesRequest request = new ListPublicAdvertisedPrefixesRequest
            {
                PageToken            = "",
                MaxResults           = 0U,
                OrderBy              = "",
                Project              = "",
                Filter               = "",
                ReturnPartialSuccess = false,
            };
            // Make the request
            PublicAdvertisedPrefixList response = await publicAdvertisedPrefixesClient.ListAsync(request);

            // End snippet
        }
Ejemplo n.º 9
0
        /// <summary>Snippet for DeleteAsync</summary>
        public async Task DeleteRequestObjectAsync()
        {
            // Snippet: DeleteAsync(DeletePublicAdvertisedPrefixeRequest, CallSettings)
            // Additional: DeleteAsync(DeletePublicAdvertisedPrefixeRequest, CancellationToken)
            // Create client
            PublicAdvertisedPrefixesClient publicAdvertisedPrefixesClient = await PublicAdvertisedPrefixesClient.CreateAsync();

            // Initialize request argument(s)
            DeletePublicAdvertisedPrefixeRequest request = new DeletePublicAdvertisedPrefixeRequest
            {
                RequestId = "",
                PublicAdvertisedPrefix = "",
                Project = "",
            };
            // Make the request
            lro::Operation <Operation, Operation> response = await publicAdvertisedPrefixesClient.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 publicAdvertisedPrefixesClient.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
        }