Example #1
0
        /// <summary>Snippet for CreateIndexAsync</summary>
        public async Task CreateIndexRequestObjectAsync()
        {
            // Snippet: CreateIndexAsync(CreateIndexRequest, CallSettings)
            // Additional: CreateIndexAsync(CreateIndexRequest, CancellationToken)
            // Create client
            IndexServiceClient indexServiceClient = await IndexServiceClient.CreateAsync();

            // Initialize request argument(s)
            CreateIndexRequest request = new CreateIndexRequest
            {
                ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
                Index = new gcav::Index(),
            };
            // Make the request
            Operation <gcav::Index, CreateIndexOperationMetadata> response = await indexServiceClient.CreateIndexAsync(request);

            // Poll until the returned long-running operation is complete
            Operation <gcav::Index, CreateIndexOperationMetadata> 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, CreateIndexOperationMetadata> retrievedResponse = await indexServiceClient.PollOnceCreateIndexAsync(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
        }
Example #2
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
        }
Example #3
0
        /// <summary>Snippet for CreateIndex</summary>
        public void CreateIndexResourceNames()
        {
            // Snippet: CreateIndex(LocationName, Index, CallSettings)
            // Create client
            IndexServiceClient indexServiceClient = IndexServiceClient.Create();
            // Initialize request argument(s)
            LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
            gcav::Index  index  = new gcav::Index();
            // Make the request
            Operation <gcav::Index, CreateIndexOperationMetadata> response = indexServiceClient.CreateIndex(parent, index);

            // Poll until the returned long-running operation is complete
            Operation <gcav::Index, CreateIndexOperationMetadata> completedResponse = response.PollUntilCompleted();
            // 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, CreateIndexOperationMetadata> retrievedResponse = indexServiceClient.PollOnceCreateIndex(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
        }
Example #4
0
        /// <summary>Snippet for UpdateIndex</summary>
        public void UpdateIndexRequestObject()
        {
            // Snippet: UpdateIndex(UpdateIndexRequest, CallSettings)
            // Create client
            IndexServiceClient indexServiceClient = IndexServiceClient.Create();
            // Initialize request argument(s)
            UpdateIndexRequest request = new UpdateIndexRequest
            {
                Index      = new gcav::Index(),
                UpdateMask = new FieldMask(),
            };
            // Make the request
            Operation <gcav::Index, UpdateIndexOperationMetadata> response = indexServiceClient.UpdateIndex(request);

            // Poll until the returned long-running operation is complete
            Operation <gcav::Index, UpdateIndexOperationMetadata> completedResponse = response.PollUntilCompleted();
            // 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 = indexServiceClient.PollOnceUpdateIndex(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
        }
Example #5
0
 /// <summary>Snippet for GetIndex</summary>
 public void GetIndexResourceNames()
 {
     // Snippet: GetIndex(IndexName, CallSettings)
     // Create client
     IndexServiceClient indexServiceClient = IndexServiceClient.Create();
     // Initialize request argument(s)
     IndexName name = IndexName.FromProjectLocationIndex("[PROJECT]", "[LOCATION]", "[INDEX]");
     // Make the request
     gcav::Index response = indexServiceClient.GetIndex(name);
     // End snippet
 }
Example #6
0
 /// <summary>Snippet for GetIndex</summary>
 public void GetIndex()
 {
     // Snippet: GetIndex(string, CallSettings)
     // Create client
     IndexServiceClient indexServiceClient = IndexServiceClient.Create();
     // Initialize request argument(s)
     string name = "projects/[PROJECT]/locations/[LOCATION]/indexes/[INDEX]";
     // Make the request
     gcav::Index response = indexServiceClient.GetIndex(name);
     // End snippet
 }
Example #7
0
        /// <summary>Snippet for GetIndexAsync</summary>
        public async Task GetIndexResourceNamesAsync()
        {
            // Snippet: GetIndexAsync(IndexName, CallSettings)
            // Additional: GetIndexAsync(IndexName, CancellationToken)
            // Create client
            IndexServiceClient indexServiceClient = await IndexServiceClient.CreateAsync();

            // Initialize request argument(s)
            IndexName name = IndexName.FromProjectLocationIndex("[PROJECT]", "[LOCATION]", "[INDEX]");
            // Make the request
            gcav::Index response = await indexServiceClient.GetIndexAsync(name);

            // End snippet
        }
Example #8
0
        /// <summary>Snippet for GetIndexAsync</summary>
        public async Task GetIndexAsync()
        {
            // Snippet: GetIndexAsync(string, CallSettings)
            // Additional: GetIndexAsync(string, CancellationToken)
            // Create client
            IndexServiceClient indexServiceClient = await IndexServiceClient.CreateAsync();

            // Initialize request argument(s)
            string name = "projects/[PROJECT]/locations/[LOCATION]/indexes/[INDEX]";
            // Make the request
            gcav::Index response = await indexServiceClient.GetIndexAsync(name);

            // End snippet
        }
Example #9
0
 /// <summary>Snippet for GetIndex</summary>
 public void GetIndexRequestObject()
 {
     // Snippet: GetIndex(GetIndexRequest, CallSettings)
     // Create client
     IndexServiceClient indexServiceClient = IndexServiceClient.Create();
     // Initialize request argument(s)
     GetIndexRequest request = new GetIndexRequest
     {
         IndexName = IndexName.FromProjectLocationIndex("[PROJECT]", "[LOCATION]", "[INDEX]"),
     };
     // Make the request
     gcav::Index response = indexServiceClient.GetIndex(request);
     // End snippet
 }