Actions
Cbjs HTTP Client offers several functions to perform various retrieval or mutations on different services.
Cluster
initCluster
Use this to setup a new cluster. Useful for CI and deployment automation.
Don't forget to use setIndexerSettings
if you use the query
service.
declare function initCluster(
apiConfig: CouchbaseHttpApiConfig,
initClusterParams: InitClusterParams
): Promise<void>;
setIndexerSettings
Configures the indexer of the query
service.
declare function setIndexerSettings(
apiConfig: CouchbaseHttpApiConfig,
settings: CouchbaseIndexerSettings
): Promise<void>;
getClusterRelease
Retrieves information about the cluster release.
Example : { version: '7.2.4', build: '1337', flavor: 'enterprise' }
declare function getClusterRelease(
apiConfig: CouchbaseHttpApiConfig
): Promise<ClusterRelease>;
getClusterRootCertificates
Retrieves the root certificates of the cluster. Useful to bootstrap some automation mechanism.
declare function getClusterRootCertificates(
apiConfig: CouchbaseHttpApiConfig
): Promise<ApiCertificate[]>;
versionSupportsFeatures
Checks if a particular release number supports a feature.
declare function versionSupportsFeatures(
version: string,
...features: ServerFeature[]
): boolean;
// Example
const isSupported = versionSupportsFeatures(
'7.2.4',
ServerFeatures.ServerDurability,
ServerFeatures.SubdocReadReplica
);
getPool
Retrieves information about the cluster pool.
declare function getPool(
params: Omit<CouchbaseHttpApiConfig, 'poolNodes'>,
poolName?: string
): Promise<ApiPool>;
Analytics
createAnalyticsLink
Creates a links to feed your analytics dataverse.
declare function createAnalyticsLink(
apiConfig: CouchbaseHttpApiConfig,
link: ApiAnalyticsLink
): Promise<void>;
getAnalyticsLinks
Retrieves the existing analytics links. You can filter by dataverse using the scope
option.
declare function getAnalyticsLinks(
apiConfig: CouchbaseHttpApiConfig,
options?: GetAnalyticsLinksOptions
): Promise<ApiAnalyticsLink[]>;
getAnalyticsClusterStatus
Retrieves various information about the current status of the analytics cluster.
declare function getAnalyticsClusterStatus(
apiConfig: CouchbaseHttpApiConfig
): Promise<AnalyticsClusterStatus>;
Eventing
deployEventingFunction
Deploys an eventing function previously created.
declare function deployEventingFunction(
apiConfig: CouchbaseHttpApiConfig,
name: string,
scope?: EventingFunctionScope
): Promise<void>;
pauseEventingFunction
Pauses an eventing function previously deployed.
declare function pauseEventingFunction(
apiConfig: CouchbaseHttpApiConfig,
name: string,
scope?: EventingFunctionScope
): Promise<void>;
resumeEventingFunction
Resumes an eventing function previously paused.
declare function resumeEventingFunction(
apiConfig: CouchbaseHttpApiConfig,
name: string,
scope?: EventingFunctionScope
): Promise<void>;
undeployEventingFunction
Undeploys an eventing function previously deployed.
declare function undeployEventingFunction(
apiConfig: CouchbaseHttpApiConfig,
name: string,
scope?: EventingFunctionScope
): Promise<void>;
dropEventingFunction
Drops an eventing function previously created.
declare function dropEventingFunction(
apiConfig: CouchbaseHttpApiConfig,
name: string,
scope?: EventingFunctionScope
): Promise<void>;
getEventingFunctionStatus
Retrieves the current status of an eventing function.
declare function getEventingFunctions(
apiConfig: CouchbaseHttpApiConfig,
): Promise<ApiEventingFunctionStatus>;
getEventingFunctions
Retrieves the existing eventing functions.
declare function getEventingFunctions(
apiConfig: CouchbaseHttpApiConfig,
): Promise<ApiEventingFunction[]>;
KeyValue
getBucket
Retrieves the settings of a bucket.
declare function getBucket(
apiConfig: CouchbaseHttpApiConfig,
bucketName: string
): Promise<ApiBucket>;
getScope
Retrieves the scopes within a bucket.
declare function getScopes(
apiConfig: CouchbaseHttpApiConfig,
bucketName: string
): Promise<ApiBucketScopes>;
getCollections
Retrieves the collections within a scope.
declare function getCollections(
apiConfig: CouchbaseHttpApiConfig,
bucketName: string,
scopeName: string
): Promise<ApiCollection[]>;
Query
executeStatement
Executes an arbitrary query.
declare function executeStatement<Result>(
params: CouchbaseHttpApiConfig,
statement: string
): Promise<ApiQueryResponseBody<Result>>;
getQueryBuckets
Retrieves the list of buckets visible from the query
service.
declare function getQueryBuckets(
params: CouchbaseHttpApiConfig
): Promise<string[]>;
getQueryIndexes
Return the list of all indexes within the given scope.
declare function getQueryIndexes(
params: CouchbaseHttpApiConfig,
options?: Partial<Keyspace>
): Promise<HttpClientQueryIndex[]>;
getQueryIndexStats
Return the stats of the index, given by the indexer.
declare function getQueryIndexStats(
params: CouchbaseHttpApiConfig,
indexName: string,
keyspace: Keyspace
): Promise<HttpClientQueryIndexStats>;
getQueryIndexRemainingMutations
Return the number of documents awaiting to be indexed.
The value is the sum of the queued (not sent to the indexer) and pending mutations (received by the indexer but not processed).
declare function getQueryIndexRemainingMutations(
params: CouchbaseHttpApiConfig,
indexName: string,
keyspace: Keyspace
): Promise<number>;
getQuerySearchIndexes
Retrieves the search indexes that are visible by the query
service. Useful when using Flex Index
: leveraging full-text search within a SQL++ query. You can filter by keyspace and by index name.
declare function getQuerySearchIndexes(
params: CouchbaseHttpApiConfig,
options?: {
bucket?: string,
scope?: string,
collection?: string,
index?: string;
}
): Promise<HttpClientSearchIndex[]>;
createQueryIndex
Create a query index.
declare function createQueryIndex(
params: CouchbaseHttpApiConfig,
indexName: string,
keyspace: Keyspace,
config: {
keys: string[],
where?: string,
numReplicas?: number
},
options?: CreateQueryIndexOptions
): Promise<CreateQueryIndexResponse>;
updateQueryIndex
Update a query index.
declare function updateQueryIndex(
params: CouchbaseHttpApiConfig,
indexName: string,
keyspace: Keyspace,
config: {
action: 'move' | 'replica_count' | 'drop_replica';
num_replica?: number;
nodes?: string[];
replicaId?: string;
}
): Promise<[]>;
RBAC
whoami
Retrieves a user by its username. Can filter by domain using a third parameter.
declare function whoami(
apiConfig: CouchbaseHttpApiConfig
): Promise<ApiWhoami>;
getUser
Retrieves a user by its username. Can filter by domain using a third parameter.
declare function getUser(
apiConfig: CouchbaseHttpApiConfig,
username: string,
domain?: string
): Promise<ApiUser>;
updateUserPassword
Update a user's password.
declare function updateUserPassword(
apiConfig: CouchbaseHttpApiConfig,
newPassword: string,
): Promise<void>;
getUsers
Retrieves all the existing users.
declare function getUsers(
apiConfig: CouchbaseHttpApiConfig
): Promise<ApiUser[]>;
getUserGroup
Retrieves a user group by its name.
declare function getUserGroup(
apiConfig: CouchbaseHttpApiConfig,
name: string
): Promise<ApiUserGroup>;
getUserGroups
Retrieves all the existing user groups.
declare function getUserGroups(
apiConfig: CouchbaseHttpApiConfig
): Promise<ApiUserGroup[]>;
getRoles
Retrieves all the existing roles.
declare function getRoles(
apiConfig: CouchbaseHttpApiConfig
): Promise<ApiRole[]>;
Search / FTS
getSearchIndex
Retrieves information about a search index.
declare function getSearchIndex(
params: CouchbaseHttpApiConfig,
indexName: string
): Promise<ApiSearchGetIndex>;
getSearchIndexes
Retrieves all the existing search indexes.
declare function getSearchIndexes(
params: CouchbaseHttpApiConfig
): Promise<ApiSearchGetAllIndexes>;
getSearchIndexStatistics
Retrieves the statistics related to a search index.
declare function getSearchIndexStatistics(
params: CouchbaseHttpApiConfig,
indexName: string
): Promise<ApiSearchGetIndex>;
Stats
getIndexerStatistics
Retrieves various statistics about the query indexer.
declare function getIndexerStatistics(
apiConfig: CouchbaseHttpApiConfig,
skipEmpty?: boolean
): Promise<IndexerStatistics['indexer']>;
getStatistics
Retrieves multiple statistics at once.
declare function getStatistics(
apiConfig: CouchbaseHttpApiConfig,
stats: [StatisticDefinition, ...StatisticDefinition[]]
): Promise<[StatisticsResult, ...StatisticsResult[]]>;
Views
getViewDesignDocuments
Retrieves the views existing within a bucket.
declare function getViewDesignDocuments(params: CouchbaseHttpApiConfig, bucketName: string): Promise<ApiViewDesignDocuments>;