Exemplo n.º 1
0
        /// <summary>Snippet for UpdateIndexAsync</summary>
        public async Task UpdateIndexAsync()
        {
            // Snippet: UpdateIndexAsync(Index, FieldMask, CallSettings)
            // Additional: UpdateIndexAsync(Index, FieldMask, CancellationToken)
            // Create client
            IndexServiceClient indexServiceClient = await IndexServiceClient.CreateAsync();

            // Initialize request argument(s)
            gcav::Index index      = new gcav::Index();
            FieldMask   updateMask = new FieldMask();
            // Make the request
            Operation <gcav::Index, UpdateIndexOperationMetadata> response = await indexServiceClient.UpdateIndexAsync(index, updateMask);

            // Poll until the returned long-running operation is complete
            Operation <gcav::Index, UpdateIndexOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            gcav::Index 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 <gcav::Index, UpdateIndexOperationMetadata> retrievedResponse = await indexServiceClient.PollOnceUpdateIndexAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                gcav::Index retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }