@project-lakechain/opensearch-index
Version:
Creates an OpenSearch index using AWS CDK.
66 lines (65 loc) • 2.06 kB
TypeScript
import * as ec2 from 'aws-cdk-lib/aws-ec2';
import * as opensearch from 'aws-cdk-lib/aws-opensearchservice';
import * as oss from '@project-lakechain/opensearch-collection';
import * as logs from 'aws-cdk-lib/aws-logs';
import { Construct } from 'constructs';
/**
* The properties for the OpenSearchIndex construct.
*/
export interface OpenSearchIndexProps {
/**
* The name of the index.
*/
readonly indexName: string;
/**
* The body of the index creation request.
*/
readonly body: Record<string, any>;
/**
* The OpenSearch endpoint on which the index
* should be created.
*/
readonly endpoint: opensearch.IDomain | oss.ICollection;
/**
* The VPC in which the OpenSearch domain is deployed.
*/
readonly vpc?: ec2.IVpc;
/**
* The log group in which the lambda function will
* write its logs.
*/
readonly logGroup?: logs.ILogGroup;
}
/**
* A custom resource making it easy to create an index
* and manage its lifecycle as a CDK construct.
* This construct uses a lambda function to interact with
* the OpenSearch endpoint, and uses the OpenSearch SDK to
* create and delete the index.
* This construct is compatible with OpenSearch domains and serverless
* collections deployed in a VPC or not.
*/
export declare class OpenSearchIndex extends Construct {
/**
* The name of the index managed by the construct.
*/
readonly indexName: string;
/**
* OpenSearch Index constructor
* @param scope the scope of the construct
* @param id the id of the construct
*/
constructor(scope: Construct, id: string, props: OpenSearchIndexProps);
/**
* Get the URL of the OpenSearch endpoint.
* @param endpoint the OpenSearch endpoint.
* @returns the endpoint URL.
*/
private getEndpoint;
/**
* Get the service identifier of the OpenSearch endpoint.
* @param endpoint the OpenSearch endpoint.
* @returns the service identifier.
*/
private getServiceIdentifier;
}