/// <summary>Snippet for DeleteIndexAsync</summary> public async Task DeleteIndexRequestObjectAsync() { // Snippet: DeleteIndexAsync(DeleteIndexRequest, CallSettings) // Additional: DeleteIndexAsync(DeleteIndexRequest, CancellationToken) // Create client DatastoreAdminClient datastoreAdminClient = await DatastoreAdminClient.CreateAsync(); // Initialize request argument(s) DeleteIndexRequest request = new DeleteIndexRequest { ProjectId = "", IndexId = "", }; // Make the request Operation <gcdav::Index, IndexOperationMetadata> response = await datastoreAdminClient.DeleteIndexAsync(request); // Poll until the returned long-running operation is complete Operation <gcdav::Index, IndexOperationMetadata> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result gcdav::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 <gcdav::Index, IndexOperationMetadata> retrievedResponse = await datastoreAdminClient.PollOnceDeleteIndexAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result gcdav::Index retrievedResult = retrievedResponse.Result; } // End snippet }
/// <summary>Snippet for ListIndexesAsync</summary> public async Task ListIndexesRequestObjectAsync() { // Snippet: ListIndexesAsync(ListIndexesRequest, CallSettings) // Create client DatastoreAdminClient datastoreAdminClient = await DatastoreAdminClient.CreateAsync(); // Initialize request argument(s) ListIndexesRequest request = new ListIndexesRequest { ProjectId = "", Filter = "", }; // Make the request PagedAsyncEnumerable <ListIndexesResponse, gcdav::Index> response = datastoreAdminClient.ListIndexesAsync(request); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((gcdav::Index 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((ListIndexesResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (gcdav::Index 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 <gcdav::Index> 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 (gcdav::Index 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 GetIndexAsync</summary> public async Task GetIndexRequestObjectAsync() { // Snippet: GetIndexAsync(GetIndexRequest, CallSettings) // Additional: GetIndexAsync(GetIndexRequest, CancellationToken) // Create client DatastoreAdminClient datastoreAdminClient = await DatastoreAdminClient.CreateAsync(); // Initialize request argument(s) GetIndexRequest request = new GetIndexRequest { ProjectId = "", IndexId = "", }; // Make the request gcdav::Index response = await datastoreAdminClient.GetIndexAsync(request); // End snippet }
/// <summary>Snippet for ExportEntitiesAsync</summary> public async Task ExportEntitiesRequestObjectAsync() { // Snippet: ExportEntitiesAsync(ExportEntitiesRequest, CallSettings) // Additional: ExportEntitiesAsync(ExportEntitiesRequest, CancellationToken) // Create client DatastoreAdminClient datastoreAdminClient = await DatastoreAdminClient.CreateAsync(); // Initialize request argument(s) ExportEntitiesRequest request = new ExportEntitiesRequest { ProjectId = "", Labels = { { "", "" }, }, EntityFilter = new EntityFilter(), OutputUrlPrefix = "", }; // Make the request Operation <ExportEntitiesResponse, ExportEntitiesMetadata> response = await datastoreAdminClient.ExportEntitiesAsync(request); // Poll until the returned long-running operation is complete Operation <ExportEntitiesResponse, ExportEntitiesMetadata> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result ExportEntitiesResponse 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 <ExportEntitiesResponse, ExportEntitiesMetadata> retrievedResponse = await datastoreAdminClient.PollOnceExportEntitiesAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result ExportEntitiesResponse retrievedResult = retrievedResponse.Result; } // End snippet }
/// <summary>Snippet for ImportEntitiesAsync</summary> public async Task ImportEntitiesAsync() { // Snippet: ImportEntitiesAsync(string, IDictionary<string,string>, string, EntityFilter, CallSettings) // Additional: ImportEntitiesAsync(string, IDictionary<string,string>, string, EntityFilter, CancellationToken) // Create client DatastoreAdminClient datastoreAdminClient = await DatastoreAdminClient.CreateAsync(); // Initialize request argument(s) string projectId = ""; IDictionary <string, string> labels = new Dictionary <string, string> { { "", "" }, }; string inputUrl = ""; EntityFilter entityFilter = new EntityFilter(); // Make the request Operation <Empty, ImportEntitiesMetadata> response = await datastoreAdminClient.ImportEntitiesAsync(projectId, labels, inputUrl, entityFilter); // Poll until the returned long-running operation is complete Operation <Empty, ImportEntitiesMetadata> 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, ImportEntitiesMetadata> retrievedResponse = await datastoreAdminClient.PollOnceImportEntitiesAsync(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 }