Cloud AI Platform v1 API - Class IndexServiceClient (2.12.0)

public abstract class IndexServiceClient

Reference documentation and code samples for the Cloud AI Platform v1 API class IndexServiceClient.

IndexService client wrapper, for convenient use.

Inheritance

object > IndexServiceClient

Derived Types

Namespace

GoogleCloudGoogle.Cloud.AIPlatformV1

Assembly

Google.Cloud.AIPlatform.V1.dll

Remarks

A service for creating and managing Vertex AI's Index resources.

Properties

CreateIndexOperationsClient

public virtual OperationsClient CreateIndexOperationsClient { get; }

The long-running operations client for CreateIndex.

Property Value
TypeDescription
OperationsClient

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the IndexService service, which is a host of "aiplatform.googleapis.com" and a port of 443.

Property Value
TypeDescription
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default IndexService scopes.

Property Value
TypeDescription
IReadOnlyListstring
Remarks

The default IndexService scopes are:

DeleteIndexOperationsClient

public virtual OperationsClient DeleteIndexOperationsClient { get; }

The long-running operations client for DeleteIndex.

Property Value
TypeDescription
OperationsClient

GrpcClient

public virtual IndexService.IndexServiceClient GrpcClient { get; }

The underlying gRPC IndexService client

Property Value
TypeDescription
IndexServiceIndexServiceClient

IAMPolicyClient

public virtual IAMPolicyClient IAMPolicyClient { get; }

The IAMPolicyClient associated with this client.

Property Value
TypeDescription
IAMPolicyClient

LocationsClient

public virtual LocationsClient LocationsClient { get; }

The LocationsClient associated with this client.

Property Value
TypeDescription
LocationsClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
TypeDescription
ServiceMetadata

UpdateIndexOperationsClient

public virtual OperationsClient UpdateIndexOperationsClient { get; }

The long-running operations client for UpdateIndex.

Property Value
TypeDescription
OperationsClient

Methods

Create()

public static IndexServiceClient Create()

Synchronously creates a IndexServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use IndexServiceClientBuilder.

Returns
TypeDescription
IndexServiceClient

The created IndexServiceClient.

CreateAsync(CancellationToken)

public static Task<IndexServiceClient> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a IndexServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use IndexServiceClientBuilder.

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
TaskIndexServiceClient

The task representing the created IndexServiceClient.

CreateIndex(LocationName, Index, CallSettings)

public virtual Operation<Index, CreateIndexOperationMetadata> CreateIndex(LocationName parent, Index index, CallSettings callSettings = null)

Creates an Index.

Parameters
NameDescription
parentLocationName

Required. The resource name of the Location to create the Index in. Format: projects/{project}/locations/{location}

indexIndex

Required. The Index to create.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationIndexCreateIndexOperationMetadata

The RPC response.

Example
// 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;
}

CreateIndex(CreateIndexRequest, CallSettings)

public virtual Operation<Index, CreateIndexOperationMetadata> CreateIndex(CreateIndexRequest request, CallSettings callSettings = null)

Creates an Index.

Parameters
NameDescription
requestCreateIndexRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationIndexCreateIndexOperationMetadata

The RPC response.

Example
// Create client
IndexServiceClient indexServiceClient = IndexServiceClient.Create();
// 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 = indexServiceClient.CreateIndex(request);

// 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;
}

CreateIndex(string, Index, CallSettings)

public virtual Operation<Index, CreateIndexOperationMetadata> CreateIndex(string parent, Index index, CallSettings callSettings = null)

Creates an Index.

Parameters
NameDescription
parentstring

Required. The resource name of the Location to create the Index in. Format: projects/{project}/locations/{location}

indexIndex

Required. The Index to create.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationIndexCreateIndexOperationMetadata

The RPC response.

Example
// Create client
IndexServiceClient indexServiceClient = IndexServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[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;
}

CreateIndexAsync(LocationName, Index, CallSettings)

public virtual Task<Operation<Index, CreateIndexOperationMetadata>> CreateIndexAsync(LocationName parent, Index index, CallSettings callSettings = null)

Creates an Index.

Parameters
NameDescription
parentLocationName

Required. The resource name of the Location to create the Index in. Format: projects/{project}/locations/{location}

indexIndex

Required. The Index to create.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationIndexCreateIndexOperationMetadata

A Task containing the RPC response.

Example
// Create client
IndexServiceClient indexServiceClient = await IndexServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
gcav::Index index = new gcav::Index();
// Make the request
Operation<gcav::Index, CreateIndexOperationMetadata> response = await indexServiceClient.CreateIndexAsync(parent, index);

// 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;
}

CreateIndexAsync(LocationName, Index, CancellationToken)

public virtual Task<Operation<Index, CreateIndexOperationMetadata>> CreateIndexAsync(LocationName parent, Index index, CancellationToken cancellationToken)

Creates an Index.

Parameters
NameDescription
parentLocationName

Required. The resource name of the Location to create the Index in. Format: projects/{project}/locations/{location}

indexIndex

Required. The Index to create.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationIndexCreateIndexOperationMetadata

A Task containing the RPC response.

Example
// Create client
IndexServiceClient indexServiceClient = await IndexServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
gcav::Index index = new gcav::Index();
// Make the request
Operation<gcav::Index, CreateIndexOperationMetadata> response = await indexServiceClient.CreateIndexAsync(parent, index);

// 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;
}

CreateIndexAsync(CreateIndexRequest, CallSettings)

public virtual Task<Operation<Index, CreateIndexOperationMetadata>> CreateIndexAsync(CreateIndexRequest request, CallSettings callSettings = null)

Creates an Index.

Parameters
NameDescription
requestCreateIndexRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationIndexCreateIndexOperationMetadata

A Task containing the RPC response.

Example
// 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;
}

CreateIndexAsync(CreateIndexRequest, CancellationToken)

public virtual Task<Operation<Index, CreateIndexOperationMetadata>> CreateIndexAsync(CreateIndexRequest request, CancellationToken cancellationToken)

Creates an Index.

Parameters
NameDescription
requestCreateIndexRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationIndexCreateIndexOperationMetadata

A Task containing the RPC response.

Example
// 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;
}

CreateIndexAsync(string, Index, CallSettings)

public virtual Task<Operation<Index, CreateIndexOperationMetadata>> CreateIndexAsync(string parent, Index index, CallSettings callSettings = null)

Creates an Index.

Parameters
NameDescription
parentstring

Required. The resource name of the Location to create the Index in. Format: projects/{project}/locations/{location}

indexIndex

Required. The Index to create.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationIndexCreateIndexOperationMetadata

A Task containing the RPC response.

Example
// Create client
IndexServiceClient indexServiceClient = await IndexServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
gcav::Index index = new gcav::Index();
// Make the request
Operation<gcav::Index, CreateIndexOperationMetadata> response = await indexServiceClient.CreateIndexAsync(parent, index);

// 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;
}

CreateIndexAsync(string, Index, CancellationToken)

public virtual Task<Operation<Index, CreateIndexOperationMetadata>> CreateIndexAsync(string parent, Index index, CancellationToken cancellationToken)

Creates an Index.

Parameters
NameDescription
parentstring

Required. The resource name of the Location to create the Index in. Format: projects/{project}/locations/{location}

indexIndex

Required. The Index to create.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationIndexCreateIndexOperationMetadata

A Task containing the RPC response.

Example
// Create client
IndexServiceClient indexServiceClient = await IndexServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
gcav::Index index = new gcav::Index();
// Make the request
Operation<gcav::Index, CreateIndexOperationMetadata> response = await indexServiceClient.CreateIndexAsync(parent, index);

// 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;
}

DeleteIndex(DeleteIndexRequest, CallSettings)

public virtual Operation<Empty, DeleteOperationMetadata> DeleteIndex(DeleteIndexRequest request, CallSettings callSettings = null)

Deletes an Index. An Index can only be deleted when all its [DeployedIndexes][google.cloud.aiplatform.v1.Index.deployed_indexes] had been undeployed.

Parameters
NameDescription
requestDeleteIndexRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationEmptyDeleteOperationMetadata

The RPC response.

Example
// Create client
IndexServiceClient indexServiceClient = IndexServiceClient.Create();
// Initialize request argument(s)
DeleteIndexRequest request = new DeleteIndexRequest
{
    IndexName = IndexName.FromProjectLocationIndex("[PROJECT]", "[LOCATION]", "[INDEX]"),
};
// Make the request
Operation<Empty, DeleteOperationMetadata> response = indexServiceClient.DeleteIndex(request);

// Poll until the returned long-running operation is complete
Operation<Empty, DeleteOperationMetadata> completedResponse = response.PollUntilCompleted();
// 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, DeleteOperationMetadata> retrievedResponse = indexServiceClient.PollOnceDeleteIndex(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;
}

DeleteIndex(IndexName, CallSettings)

public virtual Operation<Empty, DeleteOperationMetadata> DeleteIndex(IndexName name, CallSettings callSettings = null)

Deletes an Index. An Index can only be deleted when all its [DeployedIndexes][google.cloud.aiplatform.v1.Index.deployed_indexes] had been undeployed.

Parameters
NameDescription
nameIndexName

Required. The name of the Index resource to be deleted. Format: projects/{project}/locations/{location}/indexes/{index}

callSettings