UNPKG

@project-lakechain/opensearch-collection

Version:

Creates an OpenSearch Serverless collection in a VPC.

133 lines (132 loc) 4.04 kB
import * as cdk from 'aws-cdk-lib'; import * as ec2 from 'aws-cdk-lib/aws-ec2'; import * as opensearchserverless from 'aws-cdk-lib/aws-opensearchserverless'; import { Construct } from 'constructs'; /** * A helper function to format the name of a resource. * @param text the text to format * @param maxLength the maximum length of the text * @returns the formatted name */ export declare const formatName: (text: string, maxLength?: number) => string; /** * The possible collection types. */ export type CollectionType = 'SEARCH' | 'TIMESERIES' | 'VECTORSEARCH'; /** * The OpenSearch collection interface. */ export interface ICollection extends cdk.IResource { /** * The name of the collection. * @attribute */ readonly collectionName: string; /** * The ARN of the collection. * @attribute */ readonly collectionArn: string; /** * The identifier of the collection. * @attribute */ readonly collectionId: string; /** * The endpoint associated with the collection. * @attribute */ readonly collectionEndpoint: string; /** * The endpoint associated with the collection dashboard. * @attribute */ readonly dashboardEndpoint: string; } declare abstract class CollectionBase extends cdk.Resource implements ICollection { abstract readonly collectionName: string; abstract readonly collectionArn: string; abstract readonly collectionId: string; abstract readonly collectionEndpoint: string; abstract readonly dashboardEndpoint: string; } /** * The properties for creating an OpenSearch collection. */ export interface CollectionProps { /** * The name of the collection. */ name: string; /** * The description of the collection. */ description?: string; /** * The VPC in which the OpenSearch collection is deployed. */ vpc: ec2.IVpc; /** * The collection type. */ type: CollectionType; } /** * The properties of an existing OpenSearch collection. */ export interface CollectionAttributes { /** * The name of the OpenSearch collection. */ readonly collectionName: string; /** * The ARN of the OpenSearch collection. */ readonly collectionArn: string; /** * The identifier of the OpenSearch collection. */ readonly collectionId: string; /** * The endpoint of the OpenSearch collection. */ readonly collectionEndpoint: string; /** * The dashboard endpoint of the OpenSearch collection. */ readonly dashboardEndpoint: string; } /** * The OpenSearch collection construct allows to create * a serverless OpenSearch collection within a VPC. */ export declare class Collection extends CollectionBase implements ICollection { readonly collectionName: string; readonly collectionArn: string; readonly collectionId: string; readonly collectionEndpoint: string; readonly dashboardEndpoint: string; readonly cfnCollection: opensearchserverless.CfnCollection; /** * Creates a collection construct that represents an external collection. * @param scope The parent creating construct (usually `this`). * @param id The construct's name. * @param attrs A `CollectionAttributes` object. */ static fromCollectionAttributes(scope: Construct, id: string, attrs: CollectionAttributes): ICollection; /** * OpenSearch collection constructor. * @param scope the scope of the construct * @param id the id of the construct * @param props the collection properties */ constructor(scope: Construct, id: string, props: CollectionProps); /** * Creates a new access policy for the collection. * @param name the name of the access policy. * @param principal the principal to grant access to. * @param permissions the permissions to grant. */ addAccessPolicy(name: string, principal: (string | undefined)[], permissions: string[]): void; } export {};