oracle.nosql.driver.ops.GetIndexesRequest Maven / Gradle / Ivy
Show all versions of nosqldriver Show documentation
/*-
* Copyright (c) 2011, 2020 Oracle and/or its affiliates. All rights reserved.
*
* Licensed under the Universal Permissive License v 1.0 as shown at
* https://oss.oracle.com/licenses/upl/
*/
package oracle.nosql.driver.ops;
import oracle.nosql.driver.NoSQLHandle;
import oracle.nosql.driver.NoSQLHandleConfig;
import oracle.nosql.driver.iam.SignatureProvider;
import oracle.nosql.driver.ops.serde.Serializer;
import oracle.nosql.driver.ops.serde.SerializerFactory;
/**
* Represents the argument of a {@link NoSQLHandle#getIndexes} operation
* which returns the information of a specific index or all indexes of
* the specified table, as returned in {@link GetIndexesResult}.
*
* The table name is a required parameter.
*
* @see NoSQLHandle#getIndexes
*/
public class GetIndexesRequest extends Request {
private String indexName;
/**
* Sets the table name to use for the request
*
* @param tableName the table name. This is a required parameter.
*
* @return this
*/
public GetIndexesRequest setTableName(String tableName) {
super.setTableNameInternal(tableName);
return this;
}
/**
* Cloud service only.
*
* Sets the name or id of a compartment to be used for this operation.
*
* The compartment may be specified as either a name (or path for nested
* compartments) or as an id (OCID). A name (vs id) can only
* be used when authenticated using a specific user identity. It is
* not available if authenticated as an Instance Principal which can
* be done when calling the service from a compute instance in the Oracle
* Cloud Infrastructure. See {@link
* SignatureProvider#createWithInstancePrincipal}
*
* @param compartment the name or id. If using a nested compartment,
* specify the full compartment path
* compartmentA.compartmentB
, but exclude the name of the
* root compartment (tenant).
*
* @return this
*/
public GetIndexesRequest setCompartment(String compartment) {
super.setCompartmentInternal(compartment);
return this;
}
/**
* Sets the index name to use for the request. If not set, this
* request will return all indexes of the table.
*
* @param indexName the index name.
*
* @return this
*/
public GetIndexesRequest setIndexName(String indexName) {
this.indexName = indexName;
return this;
}
/**
* Gets the index name to use for the request
*
* @return the index name
*/
public String getIndexName() {
return indexName;
}
/**
* Sets the request timeout value, in milliseconds. This overrides any
* default value set in {@link NoSQLHandleConfig}. The value must be
* positive.
*
* @param timeoutMs the timeout value, in milliseconds
*
* @return this
*
* @throws IllegalArgumentException if the timeout value is less than
* or equal to 0
*/
public GetIndexesRequest setTimeout(int timeoutMs) {
super.setTimeoutInternal(timeoutMs);
return this;
}
/**
* @hidden
*/
@Override
public void validate() {
if (tableName == null) {
throw new IllegalArgumentException(
"GetIndexesRequest requires a table name");
}
}
@Override
public Serializer createSerializer(SerializerFactory factory) {
return factory.createGetIndexesSerializer();
}
@Override
public Serializer createDeserializer(SerializerFactory factory) {
return factory.createGetIndexesDeserializer();
}
/**
* @hidden
*/
@Override
public boolean shouldRetry() {
return false;
}
}