コード例 #1
0
        /// <summary>Snippet for GetOperationAsync</summary>
        public async Task GetOperationAsync()
        {
            // Snippet: GetOperationAsync(string,CallSettings)
            // Additional: GetOperationAsync(string,CancellationToken)
            // Create client
            OperationsClient operationsClient = await OperationsClient.CreateAsync();

            // Initialize request argument(s)
            string name = "";
            // Make the request
            Operation response = await operationsClient.GetOperationAsync(name);

            // End snippet
        }
コード例 #2
0
        /// <summary>Snippet for ListOperationsAsync</summary>
        public async Task ListOperationsAsync_RequestObject()
        {
            // Snippet: ListOperationsAsync(ListOperationsRequest,CallSettings)
            // Create client
            OperationsClient operationsClient = await OperationsClient.CreateAsync();

            // Initialize request argument(s)
            ListOperationsRequest request = new ListOperationsRequest
            {
                Name   = "",
                Filter = "",
            };
            // Make the request
            PagedAsyncEnumerable <ListOperationsResponse, Operation> response =
                operationsClient.ListOperationsAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((Operation 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((ListOperationsResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Operation item in page)
                {
                    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 <Operation> 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 (Operation item in singlePage)
            {
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
コード例 #3
0
        /// <summary>Snippet for GetOperationAsync</summary>
        public async Task GetOperationAsync_RequestObject()
        {
            // Snippet: GetOperationAsync(GetOperationRequest,CallSettings)
            // Create client
            OperationsClient operationsClient = await OperationsClient.CreateAsync();

            // Initialize request argument(s)
            GetOperationRequest request = new GetOperationRequest
            {
                Name = "",
            };
            // Make the request
            Operation response = await operationsClient.GetOperationAsync(request);

            // End snippet
        }
コード例 #4
0
        /// <summary>Snippet for DeleteOperationAsync</summary>
        public async Task DeleteOperationAsync_RequestObject()
        {
            // Snippet: DeleteOperationAsync(DeleteOperationRequest,CallSettings)
            // Create client
            OperationsClient operationsClient = await OperationsClient.CreateAsync();

            // Initialize request argument(s)
            DeleteOperationRequest request = new DeleteOperationRequest
            {
                Name = "",
            };
            // Make the request
            await operationsClient.DeleteOperationAsync(request);

            // End snippet
        }
コード例 #5
0
        /// <summary>Snippet for CancelOperationAsync</summary>
        public async Task CancelOperationRequestObjectAsync()
        {
            // Snippet: CancelOperationAsync(CancelOperationRequest, CallSettings)
            // Additional: CancelOperationAsync(CancelOperationRequest, CancellationToken)
            // Create client
            OperationsClient operationsClient = await OperationsClient.CreateAsync();

            // Initialize request argument(s)
            CancelOperationRequest request = new CancelOperationRequest {
                Name = "",
            };
            // Make the request
            await operationsClient.CancelOperationAsync(request);

            // End snippet
        }
コード例 #6
0
        /// <summary>Snippet for WaitOperationAsync</summary>
        public async Task WaitOperationRequestObjectAsync()
        {
            // Snippet: WaitOperationAsync(WaitOperationRequest, CallSettings)
            // Additional: WaitOperationAsync(WaitOperationRequest, CancellationToken)
            // Create client
            OperationsClient operationsClient = await OperationsClient.CreateAsync();

            // Initialize request argument(s)
            WaitOperationRequest request = new WaitOperationRequest
            {
                Name    = "",
                Timeout = new Duration(),
            };
            // Make the request
            Operation response = await operationsClient.WaitOperationAsync(request);

            // End snippet
        }