repo_name
string
dataset
string
owner
string
lang
string
func_name
string
code
string
docstring
string
url
string
sha
string
project-lakechain
github_2023
awslabs
typescript
MultiOutputPipeline.createDeliveryStream
private createDeliveryStream() { const firehoseStorageConnectorBucket = new s3.Bucket(this, 'FirehoseStorageConnectorBucket', { encryption: s3.BucketEncryption.S3_MANAGED, blockPublicAccess: s3.BlockPublicAccess.BLOCK_ALL, autoDeleteObjects: true, removalPolicy: cdk.RemovalPolicy.DESTROY, ...
/** * Creates the Firehose delivery stream. * @returns the created delivery stream. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/storage-connector-pipeline/stack.ts#L186-L212
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
MultiOutputPipeline.getFirehoseRole
private getFirehoseRole(id: string, bucket: s3.IBucket): iam.IRole { const role = new iam.Role(this, id, { assumedBy: new iam.ServicePrincipal('firehose.amazonaws.com') }); role.addToPolicy(new iam.PolicyStatement({ actions: [ 's3:AbortMultipartUpload', 's3:GetBucketLocation', ...
/** * Creates the IAM role to be used by the Firehose * delivery stream. * @param id the identifier of the role. * @returns the created role. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/storage-connector-pipeline/stack.ts#L220-L241
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
AudioRecordingSummarizationStack.constructor
constructor(scope: Construct, id: string, env: cdk.StackProps) { super(scope, id, { description: 'A pipeline summarizing audio recordings using Amazon Transcribe and Amazon Bedrock.', ...env }); /////////////////////////////////////////// /////// S3 Storage /////// ////...
/** * Stack constructor. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/summarization-pipelines/audio-recording-summarization-pipeline/stack.ts#L45-L145
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
BedrockSummarizationStack.constructor
constructor(scope: Construct, id: string, env: cdk.StackProps) { super(scope, id, { description: 'A pipeline summarizing text documents using Amazon Bedrock.', ...env }); /////////////////////////////////////////// /////// S3 Storage /////// ////////////////////////////...
/** * Stack constructor. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/summarization-pipelines/claude-summarization-pipeline/stack.ts#L50-L156
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
ExtractiveSummarizationStack.constructor
constructor(scope: Construct, id: string, env: cdk.StackProps) { super(scope, id, { description: 'A pipeline summarizing text documents using BERT extractive summarizer.', ...env }); // The VPC in which the summarization models will be deployed. const vpc = this.createVpc('Vpc'); /////...
/** * Stack constructor. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/summarization-pipelines/extractive-summarization-pipeline/stack.ts#L51-L134
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
ExtractiveSummarizationStack.createVpc
private createVpc(id: string): ec2.IVpc { return (new ec2.Vpc(this, id, { enableDnsSupport: true, enableDnsHostnames: true, ipAddresses: ec2.IpAddresses.cidr('10.0.0.0/20'), maxAzs: 3, subnetConfiguration: [{ // Used by NAT Gateways to provide Internet access // to the ...
/** * @param id the VPC identifier. * @returns a new VPC with a public, private and isolated * subnets for the pipeline. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/summarization-pipelines/extractive-summarization-pipeline/stack.ts#L141-L165
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
LlamaSummarizationPipeline.constructor
constructor(scope: Construct, id: string, env: cdk.StackProps) { super(scope, id, { description: 'A pipeline summarizing text documents using Amazon Bedrock.', ...env }); /////////////////////////////////////////// /////// S3 Storage /////// ////////////////////////////...
/** * Stack constructor. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/summarization-pipelines/llama-summarization-pipeline/stack.ts#L50-L150
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
MistralSummarizationPipeline.constructor
constructor(scope: Construct, id: string, env: cdk.StackProps) { super(scope, id, { description: 'A pipeline summarizing text documents using Mistral models on Amazon Bedrock.', ...env }); /////////////////////////////////////////// /////// S3 Storage /////// //////////...
/** * Stack constructor. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/summarization-pipelines/mistral-summarization-pipeline/stack.ts#L50-L150
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
OllamaSummarizationStack.constructor
constructor(scope: Construct, id: string, env: cdk.StackProps) { super(scope, id, { description: 'A pipeline summarizing text documents using Ollama.', ...env }); // The VPC in which the ollama model will be deployed. const vpc = this.createVpc('Vpc'); /////////////////////////////////...
/** * Stack constructor. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/summarization-pipelines/ollama-summarization-pipeline/stack.ts#L56-L163
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
OllamaSummarizationStack.createVpc
private createVpc(id: string): ec2.IVpc { return (new ec2.Vpc(this, id, { enableDnsSupport: true, enableDnsHostnames: true, ipAddresses: ec2.IpAddresses.cidr('10.0.0.0/20'), maxAzs: 1, subnetConfiguration: [{ // Used by NAT Gateways to provide Internet access // to the ...
/** * @param id the VPC identifier. * @returns a new VPC with a public, private and isolated * subnets for the pipeline. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/summarization-pipelines/ollama-summarization-pipeline/stack.ts#L170-L194
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
TitanSummarizationPipeline.constructor
constructor(scope: Construct, id: string, env: cdk.StackProps) { super(scope, id, { description: 'A pipeline summarizing text documents using Amazon Titan.', ...env }); /////////////////////////////////////////// /////// S3 Storage /////// //////////////////////////////...
/** * Stack constructor. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/summarization-pipelines/titan-summarization-pipeline/stack.ts#L50-L150
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
intent
const intent = async (events: CloudEvent[], ffmpeg: Ffmpeg, utils: FfmpegUtils) => { const videos = events.filter( (event) => event.data().document().mimeType() === 'video/mp4' ); // Create the FFMPEG chain. return (ffmpeg() .input(utils.file(videos[0])) .noVideo() .save('output.mp3') ); };
/** * This intent is a function that will get executed in the cloud * by the FFMPEG middleware. It takes a video input and extracts * the audio from it. * @param events the events to process, in this case there will * be only one event, as video files are processed sequentially. * @param ffmpeg the FFMPEG instanc...
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/summarization-pipelines/video-summarization-pipeline/stack.ts#L74-L85
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
VideoSummarizationStack.constructor
constructor(scope: Construct, id: string, env: cdk.StackProps) { super(scope, id, { description: 'A pipeline summarizing video documents using Amazon Bedrock.', ...env }); // The VPC in which the FFMPEG processor will be deployed. const vpc = this.createVpc('Vpc'); ////////////////////...
/** * Stack constructor. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/summarization-pipelines/video-summarization-pipeline/stack.ts#L103-L203
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
VideoSummarizationStack.createVpc
private createVpc(id: string): ec2.IVpc { return (new ec2.Vpc(this, id, { enableDnsSupport: true, enableDnsHostnames: true, ipAddresses: ec2.IpAddresses.cidr('10.0.0.0/20'), maxAzs: 1, subnetConfiguration: [{ // Used by NAT Gateways to provide Internet access // to the ...
/** * @param id the VPC identifier. * @returns a new VPC with a public, private and isolated * subnets for the pipeline. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/summarization-pipelines/video-summarization-pipeline/stack.ts#L210-L234
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
time
const time = (offset = 10): Date => { const date = new Date(); date.setMinutes(date.getMinutes() + offset); return (date); };
/** * @returns a date based on the local timezone * with a given offset which is by default 10 minutes. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/text-processing-pipelines/article-curation-pipeline/stack.ts#L34-L38
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
ArticleStack.constructor
constructor(scope: Construct, id: string, env: cdk.StackProps) { super(scope, id, { description: 'A pipeline converting HTML articles into plain text and extracting their metadata.', ...env }); /////////////////////////////////////////// /////// S3 Storage /////// /////...
/** * Stack constructor. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/text-processing-pipelines/article-curation-pipeline/stack.ts#L56-L141
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
EmailNlpPipeline.constructor
constructor(scope: Construct, id: string, env: cdk.StackProps) { super(scope, id, { description: 'A pipeline showing how to analyze e-mails.', ...env }); /////////////////////////////////////////// /////// S3 Storage /////// /////////////////////////////////////////// ...
/** * Stack constructor. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/text-processing-pipelines/email-nlp-pipeline/stack.ts#L46-L139
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
JMESPathPipeline.constructor
constructor(scope: Construct, id: string, env: cdk.StackProps) { super(scope, id, { description: 'A pipeline parsing and transforming JSON documents.', ...env }); /////////////////////////////////////////// /////// S3 Storage /////// ////////////////////////////////////...
/** * Stack constructor. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/text-processing-pipelines/jmespath-parsing-pipeline/stack.ts#L44-L123
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
NlpStack.constructor
constructor(scope: Construct, id: string, env: cdk.StackProps) { super(scope, id, { description: 'A pipeline analyzing text documents using NLP.', ...env }); /////////////////////////////////////////// /////// S3 Storage /////// /////////////////////////////////////////...
/** * Stack constructor. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/text-processing-pipelines/nlp-pipeline/stack.ts#L50-L151
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
PdfVisionPipeline.constructor
constructor(scope: Construct, id: string, env: cdk.StackProps) { super(scope, id, { description: 'A pipeline converting PDF documents into text.', ...env }); /////////////////////////////////////////// /////// S3 Storage /////// /////////////////////////////////////////...
/** * Stack constructor. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/text-processing-pipelines/pdf-vision-pipeline/stack.ts#L49-L249
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
PiiRedactionStack.constructor
constructor(scope: Construct, id: string, env: cdk.StackProps) { super(scope, id, { description: 'A PII redaction pipeline using Project Lakechain.', ...env }); /////////////////////////////////////////// /////// S3 Storage /////// //////////////////////////////////////...
/** * Stack constructor. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/text-processing-pipelines/pii-redaction-pipeline/stack.ts#L54-L164
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
TextModerationPipeline.constructor
constructor(scope: Construct, id: string, env: cdk.StackProps) { super(scope, id, { description: 'A pipeline demonstrating how to use Amazon Comprehend for text moderation.', ...env }); /////////////////////////////////////////// /////// S3 Storage /////// /////////////...
/** * Stack constructor. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/text-processing-pipelines/text-moderation-pipeline/stack.ts#L44-L168
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
TextSplittingStack.constructor
constructor(scope: Construct, id: string, env: cdk.StackProps) { super(scope, id, { description: 'A pipeline showcasing how to split text at scale.', ...env }); /////////////////////////////////////////// /////// S3 Storage /////// //////////////////////////////////////...
/** * Stack constructor. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/text-processing-pipelines/text-splitting-pipeline/stack.ts#L42-L170
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
TextToSpeechStack.constructor
constructor(scope: Construct, id: string, env: cdk.StackProps) { super(scope, id, { description: 'A pipeline converting text to speech using Amazon Polly.', ...env }); // The VPC in which the Bark model will be deployed. const vpc = this.createVpc('Vpc'); //////////////////////////////...
/** * Stack constructor. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/text-to-speech-pipelines/bark-synthesizer/stack.ts#L47-L137
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
TextToSpeechStack.createVpc
private createVpc(id: string): ec2.IVpc { return (new ec2.Vpc(this, id, { enableDnsSupport: true, enableDnsHostnames: true, ipAddresses: ec2.IpAddresses.cidr('10.0.0.0/20'), subnetConfiguration: [{ // Used by NAT Gateways to provide Internet access // to the containers. ...
/** * @param id the VPC identifier. * @returns a new VPC with a public, private and isolated * subnets for the pipeline. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/text-to-speech-pipelines/bark-synthesizer/stack.ts#L144-L167
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
ElevenLabsSynthesisPipeline.constructor
constructor(scope: Construct, id: string, env: cdk.StackProps) { super(scope, id, { description: 'A pipeline converting text to speech using Amazon Polly.', ...env }); // Checking whether environment variables are defined. if (!process.env.ELEVENLABS_API_KEY_SECRET_NAME) { throw new E...
/** * Stack constructor. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/text-to-speech-pipelines/elevenlabs-synthesizer/stack.ts#L51-L139
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
TextToSpeechStack.constructor
constructor(scope: Construct, id: string, env: cdk.StackProps) { super(scope, id, { description: 'A pipeline converting text to speech using Amazon Polly.', ...env }); /////////////////////////////////////////// /////// S3 Storage /////// ///////////////////////////////...
/** * Stack constructor. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/text-to-speech-pipelines/polly-synthesizer/stack.ts#L45-L129
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
BedrockTranslationPipeline.constructor
constructor(scope: Construct, id: string, env: cdk.StackProps) { super(scope, id, { description: 'A pipeline demonstrating how to use Amazon Bedrock to translate documents.', ...env }); /////////////////////////////////////////// /////// S3 Storage /////// /////////////...
/** * Stack constructor. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/text-translation-pipelines/bedrock-translation-pipeline/stack.ts#L53-L187
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
TextTranslationPipeline.constructor
constructor(scope: Construct, id: string, env: cdk.StackProps) { super(scope, id, { description: 'A pipeline demonstrating how to translate documents using Amazon Translate.', ...env }); /////////////////////////////////////////// /////// S3 Storage /////// ////////////...
/** * Stack constructor. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/text-translation-pipelines/translate-pipeline/stack.ts#L42-L119
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
TranscribeStack.constructor
constructor(scope: Construct, id: string, env: cdk.StackProps) { super(scope, id, { description: 'A pipeline transcribing audio into text using Amazon Transcribe.', ...env }); /////////////////////////////////////////// /////// S3 Storage /////// ///////////////////////...
/** * Stack constructor. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/transcription-pipelines/transcribe-pipeline/stack.ts#L43-L118
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
WhisperStack.constructor
constructor(scope: Construct, id: string, env: cdk.StackProps) { super(scope, id, { description: 'A pipeline transcribing audio into text using the OpenAI Whisper model.', ...env }); // The VPC in which the whisper containers will be deployed. const vpc = this.createVpc('Vpc'); ///////...
/** * Stack constructor. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/transcription-pipelines/whisper-pipeline/stack.ts#L45-L127
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
WhisperStack.createVpc
private createVpc(id: string): ec2.IVpc { return (new ec2.Vpc(this, id, { enableDnsSupport: true, enableDnsHostnames: true, ipAddresses: ec2.IpAddresses.cidr('10.0.0.0/20'), subnetConfiguration: [{ // Used by NAT Gateways to provide Internet access // to the containers. ...
/** * @param id the VPC identifier. * @returns a new VPC with a public, private and isolated * subnets for the pipeline. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/transcription-pipelines/whisper-pipeline/stack.ts#L134-L157
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
intent
const intent = async (events: CloudEvent[], ffmpeg: Ffmpeg, utils: FfmpegUtils) => { const videos = events.filter( (event) => event.data().document().mimeType() === 'video/mp4' ); // Create the FFMPEG chain. return (ffmpeg() .input(utils.file(videos[0])) .noVideo() .save('output.mp3') ); };
/** * This intent is a function that will get executed in the cloud * by the FFMPEG middleware. It takes a video input and extracts * the audio from it. * @param events the events to process, in this case there will * be only one event, as video files are processed sequentially. * @param ffmpeg the FFMPEG instanc...
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/video-processing-pipelines/audio-extraction-pipeline/stack.ts#L46-L57
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
AudioExtractionPipeline.constructor
constructor(scope: Construct, id: string, env: cdk.StackProps) { super(scope, id, { description: 'A pipeline using FFMPEG to extract audio from video files.', ...env }); // The VPC in which the FFMPEG processor will be deployed. const vpc = this.createVpc('Vpc'); //////////////////////...
/** * Stack constructor. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/video-processing-pipelines/audio-extraction-pipeline/stack.ts#L76-L155
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
AudioExtractionPipeline.createVpc
private createVpc(id: string): ec2.IVpc { return (new ec2.Vpc(this, id, { enableDnsSupport: true, enableDnsHostnames: true, ipAddresses: ec2.IpAddresses.cidr('10.0.0.0/20'), maxAzs: 1, subnetConfiguration: [{ // Used by NAT Gateways to provide Internet access // to the ...
/** * @param id the VPC identifier. * @returns a new VPC with a public, private and isolated * subnets for the pipeline. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/examples/simple-pipelines/video-processing-pipelines/audio-extraction-pipeline/stack.ts#L162-L186
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
SamplePipeline.constructor
constructor(scope: Construct, id: string, env: cdk.StackProps) { super(scope, id, { description: 'A sample pipeline using a custom middleware.', ...env }); /////////////////////////////////////////// /////// S3 Storage /////// ///////////////////////////////////////////...
/** * Stack constructor. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/cli/lib/templates/middleware/typescript/example/stack.ts#L46-L121
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
SimpleTextProcessorBuilder.build
public build(): SimpleTextProcessor { return (new SimpleTextProcessor( this.scope, this.identifier, { ...this.props } )); }
/** * @returns a new instance of the `SimpleTextProcessor` * service constructed with the given parameters. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/cli/lib/templates/middleware/typescript/src/index.ts#L72-L79
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
SimpleTextProcessor.constructor
constructor(scope: Construct, id: string, private props: MiddlewareProps) { super(scope, id, description, { ...props, queueVisibilityTimeout: cdk.Duration.seconds( 3 * PROCESSING_TIMEOUT.toSeconds() ) }); /////////////////////////////////////////// /////// Processing Functi...
/** * Provider constructor. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/cli/lib/templates/middleware/typescript/src/index.ts#L103-L161
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
SimpleTextProcessor.grantReadProcessedDocuments
grantReadProcessedDocuments(grantee: iam.IGrantable): iam.Grant { // Since this middleware simply passes through the data // from the previous middleware, we grant any subsequent // middlewares in the pipeline read access to the // data of all source middlewares. for (const source of this.sources) {...
/** * Allows a grantee to read from the processed documents * generated by this middleware. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/cli/lib/templates/middleware/typescript/src/index.ts#L167-L176
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
SimpleTextProcessor.supportedInputTypes
supportedInputTypes(): string[] { return ([ 'text/plain' ]); }
/** * @returns an array of mime-types supported as input * type by the data producer. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/cli/lib/templates/middleware/typescript/src/index.ts#L182-L186
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
SimpleTextProcessor.supportedOutputTypes
supportedOutputTypes(): string[] { return ([ 'text/plain' ]); }
/** * @returns an array of mime-types supported as output * type by the data producer. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/cli/lib/templates/middleware/typescript/src/index.ts#L192-L196
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
SimpleTextProcessor.supportedComputeTypes
supportedComputeTypes(): ComputeType[] { return ([ ComputeType.CPU ]); }
/** * @returns the supported compute types by a given * middleware. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/cli/lib/templates/middleware/typescript/src/index.ts#L202-L206
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
SimpleTextProcessor.conditional
conditional() { return (super .conditional() .and(when('type').equals('document-created')) ); }
/** * @returns the middleware conditional statement defining * in which conditions this middleware should be executed. * In this case, we want the middleware to only be invoked * when the document mime-type is supported, and the event * type is `document-created`. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/cli/lib/templates/middleware/typescript/src/index.ts#L215-L220
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Lambda.handler
async handler(event: SQSEvent, _: Context): Promise<SQSBatchResponse> { return (await processPartialResponse( event, (record: SQSRecord) => this.processEvent( CloudEvent.from(JSON.parse(record.body)) ), processor )); }
// eslint-disable-next-line @typescript-eslint/no-unused-vars
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/cli/lib/templates/middleware/typescript/src/lambdas/word-counter/index.ts#L83-L91
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
EcsCluster.constructor
constructor(scope: Construct, id: string, private props: EcsClusterProps) { super(scope, id); // Validate the properties. this.props = EcsClusterPropsSchema.parse(props); /////////////////////////////////////////// ///////// Security Group ////////// ///////////////////////////////////...
/** * Constructs a new instance of the `EcsCluster` class. * @param scope the construct scope. * @param id the construct identifier. * @param props the construct properties. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/constructs/ecs-cluster/src/index.ts#L96-L388
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Lambda.runTasks
runTasks(taskNumber: number): Promise<any> { // Create an ECS task to process the document. return (ecs.send(new RunTaskCommand({ cluster: ECS_CLUSTER_ARN, taskDefinition: ECS_TASK_DEFINITION_ARN, capacityProviderStrategy: [{ capacityProvider: CAPACITY_PROVIDER_NAME, base: 0, ...
/** * Runs the specified number of tasks on the ECS cluster. * @param taskNumber the number of tasks to run. * @returns a promise that resolves when all the tasks * have been started. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/constructs/ecs-cluster/src/lambdas/ecs-task-autoscaler/index.ts#L92-L104
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Lambda.calculateTasksToRun
calculateTasksToRun( sqsVisibleMessages: number, currentTasksRunning: number, currentTasksPending: number ) { const currentTasksScheduled = currentTasksRunning + currentTasksPending; // If there are no visible messages on the SQS queue, // it means that there either are no documents to proces...
/** * A rudimentary algorithm to calculate the number of tasks * to start based on the number of visible messages on the * target SQS queue and the number of running tasks in the * target ECS cluster. * * The main objective of this algorithm is to be able to scale * tasks much faster than we would ...
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/constructs/ecs-cluster/src/lambdas/ecs-task-autoscaler/index.ts#L127-L171
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Lambda.getTasksDetails
async getTasksDetails(taskArns: string[]): Promise<TaskDetails> { const tasks = (await ecs.send(new DescribeTasksCommand({ cluster: ECS_CLUSTER_ARN, tasks: taskArns }))).tasks ?? []; // We group the tasks by status, categorizing them into // pending and running tasks. return (tasks.redu...
/** * @param taskArns the list of task ARNs to retrieve details for. * @returns a promise that resolves an array of both running and * pending tasks. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/constructs/ecs-cluster/src/lambdas/ecs-task-autoscaler/index.ts#L178-L194
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Lambda.handler
async handler(event: any, context: Context) { // Detailed statistics about tasks. let tasksRunning = 0; let tasksPending = 0; // Retrieve the number of messages visible on the target // SQS queue and the number of running tasks in the target // ECS cluster. const results = await Promise.all...
// eslint-disable-next-line @typescript-eslint/no-unused-vars
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/constructs/ecs-cluster/src/lambdas/ecs-task-autoscaler/index.ts#L204-L252
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Collection.fromCollectionAttributes
public static fromCollectionAttributes(scope: Construct, id: string, attrs: CollectionAttributes): ICollection { return new class extends CollectionBase { public readonly collectionName = attrs.collectionName; public readonly collectionArn = attrs.collectionArn; public readonly collectionId = attr...
/** * 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. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/constructs/opensearch-collection/src/index.ts#L160-L170
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Collection.constructor
constructor(scope: Construct, id: string, props: CollectionProps) { super(scope, id); this.collectionName = props.name; // The security group associated with the domain. const securityGroup = new ec2.SecurityGroup(this, 'SecurityGroup', { vpc: props.vpc }); // Allow VPC instances to com...
/** * OpenSearch collection constructor. * @param scope the scope of the construct * @param id the id of the construct * @param props the collection properties */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/constructs/opensearch-collection/src/index.ts#L178-L249
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Collection.addAccessPolicy
public addAccessPolicy( name: string, principal: (string | undefined)[], permissions: string[] ) { new opensearchserverless.CfnAccessPolicy(this, `AccessPolicy-${name}`, { name: formatName(`access-policy-${name}`), type: 'data', policy: JSON.stringify([{ Rules: [{ R...
/** * 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. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/constructs/opensearch-collection/src/index.ts#L257-L274
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
OpenSearchDomain.constructor
constructor(scope: Construct, id: string, props: OpenSearchDomainProps) { super(scope, id); // The security group associated with the domain. this.securityGroup = new ec2.SecurityGroup(this, 'SecurityGroup', { vpc: props.vpc, allowAllOutbound: true }); // Allow VPC instances to communi...
/** * OpenSearch domain constructor. * @param scope the scope of the construct * @param id the id of the construct */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/constructs/opensearch-domain/src/index.ts#L74-L192
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
OpenSearchIndex.constructor
constructor(scope: Construct, id: string, props: OpenSearchIndexProps) { super(scope, id); // Set the index name. this.indexName = props.indexName; // The OpenSearch endpoint. const endpoint = this.getEndpoint(props.endpoint); // The identifier of the OpenSearch service. const serviceIden...
/** * OpenSearch Index constructor * @param scope the scope of the construct * @param id the id of the construct */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/constructs/opensearch-index/src/index.ts#L86-L164
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
OpenSearchIndex.getEndpoint
private getEndpoint(endpoint: opensearch.IDomain | oss.ICollection): string { const serviceIdentifier = this.getServiceIdentifier(endpoint); if (serviceIdentifier === 'es') { return (`https://${(endpoint as opensearch.Domain).domainEndpoint}`); } else if (serviceIdentifier === 'aoss') { return ...
/** * Get the URL of the OpenSearch endpoint. * @param endpoint the OpenSearch endpoint. * @returns the endpoint URL. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/constructs/opensearch-index/src/index.ts#L171-L181
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
OpenSearchIndex.getServiceIdentifier
private getServiceIdentifier(endpoint: opensearch.IDomain | oss.ICollection): ServiceIdentifier { const e = endpoint as any; if (e.domainArn && e.domainName && e.domainId && e.domainEndpoint) { return ('es'); } else if (e.collectionName && e.collectionArn && e.collec...
/** * Get the service identifier of the OpenSearch endpoint. * @param endpoint the OpenSearch endpoint. * @returns the service identifier. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/constructs/opensearch-index/src/index.ts#L188-L204
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
onCreate
const onCreate = async () => { try { await client.indices.create({ index: INDEX_NAME, body: BODY_PARAMETERS }); } catch (error: any) { // We don't catch index already exists errors. if (error.meta?.body?.error?.type !== 'resource_already_exists_exception') { throw error; } } ...
/** * Creates the index associated with the given event. * @returns the response to the custom resource event * @throws if an error occurs */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/constructs/opensearch-index/src/lambdas/index-manager/index.ts#L62-L78
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
onDelete
const onDelete = async () => { try { await client.indices.delete({ index: INDEX_NAME }); } catch (error: any) { // The index might not exist anymore. if (error.statusCode !== 404) { throw error; } } return { PhysicalResourceId: INDEX_NAME }; };
/** * Deletes the index associated with the given event. * @returns the response to the custom resource event * @throws if an error occurs */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/constructs/opensearch-index/src/lambdas/index-manager/index.ts#L85-L98
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
OpenSearchSavedObject.constructor
constructor(scope: Construct, id: string, props: OpenSearchSavedObjectProps) { super(scope, id); // The domain endpoint. const domain = `https://${props.domain.domainEndpoint}`; // The path to the lambda function directory. const processorPath = path.resolve(__dirname, 'lambdas', 'object-manager')...
/** * OpenSearch Index constructor * @param scope the scope of the construct * @param id the id of the construct */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/constructs/opensearch-saved-object/src/index.ts#L76-L120
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
asFile
const asFile = (obj: any) => { const boundary = `----WebKitFormBoundary${Date.now().toString(16)}`; let data = `--${boundary}\r\n`; data += 'Content-Disposition: form-data; name="file"; filename="a.ndjson"\r\n'; data += 'Content-Type: application/ndjson\r\n\r\n'; data += `${obj}\r\n`; data += `--${boundary...
/** * Creates a multipart/form-data file from the given object. * @param obj the object to wrap as a multipart/form-data file * @returns a string representing the multipart/form-data file */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/constructs/opensearch-saved-object/src/lambdas/object-manager/index.ts#L41-L51
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
onCreate
const onCreate = async (event: any) => { const { SavedObject } = event.ResourceProperties; const { file, boundary } = asFile(SavedObject.data); // Upload the saved object. await client.transport.request({ method: 'POST', path: '_dashboards/api/saved_objects/_import?overwrite=true', body: file }, ...
/** * Creates the index associated with the given event. * @param event the CloudFormation custom resource event * @returns the response to the custom resource event * @throws if an error occurs */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/constructs/opensearch-saved-object/src/lambdas/object-manager/index.ts#L59-L78
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
onCreate
const onCreate = async (event: any) => { const { ServiceLinkedRole } = event.ResourceProperties; try { // Checking if the service linked role exists. await iam.send(new GetRoleCommand({ RoleName: SERVICE_LINKED_ROLE_NAME })); } catch (err: any) { if (err.name === 'NoSuchEntityException') ...
/** * Creates the service linked role associated with the given service. * @param event the CloudFormation custom resource event * @returns the response to the custom resource event * @throws if an error occurs */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/constructs/service-linked-role/src/lambdas/handler/index.ts#L52-L74
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
CacheStorage.constructor
constructor(scope: Construct, id: string, props: CacheStorageProps = {}) { super(scope, id); // By default, we destroy the cache storage when the stack is destroyed. if (!props.removalPolicy) { props.removalPolicy = cdk.RemovalPolicy.DESTROY; } // The cache storage. this.storage = new s3...
/** * `CacheStorage` constructor. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/cache-storage.ts#L54-L77
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
CacheStorage.getBucket
public getBucket(): s3.IBucket { return (this.storage); }
/** * @returns the bucket associated with the cache storage. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/cache-storage.ts#L82-L84
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
CacheStorage.id
public id(): string { return (this.storage.bucketName); }
/** * @returns the identifier of the cache storage. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/cache-storage.ts#L89-L91
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
CacheStorage.kmsKey
public kmsKey(): kms.IKey | undefined { return (this.storage.encryptionKey); }
/** * @returns the KMS key used to encrypt the cache storage. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/cache-storage.ts#L96-L98
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
CacheStorage.grantRead
public grantRead(identity: iam.IGrantable, objectsKeyPattern?: any): iam.Grant { return (this.storage.grantRead(identity, objectsKeyPattern)); }
/** * Grant read permissions for the cache storage and it's contents to an IAM * principal (Role/Group/User). * * If encryption is used, permission to use the key to decrypt the contents * of the cache storage will also be granted to the same principal. * * @param identity The principal * @param...
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/cache-storage.ts#L110-L112
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
CacheStorage.grantWrite
public grantWrite(identity: iam.IGrantable, objectsKeyPattern?: any): iam.Grant { return (this.storage.grantWrite(identity, objectsKeyPattern)); }
/** * Grant write permissions to the cache storage to an IAM principal. * * If encryption is used, permission to use the key to encrypt the contents * of written files will also be granted to the same principal. * * @param identity The principal * @param objectsKeyPattern Restrict the permission to...
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/cache-storage.ts#L123-L125
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
CacheStorage.grantReadWrite
public grantReadWrite(identity: iam.IGrantable, objectsKeyPattern?: any): iam.Grant { return (this.storage.grantReadWrite(identity, objectsKeyPattern)); }
/** * Grant read/write permissions to the cache storage to an IAM principal. * * If encryption is used, permission to use the key to encrypt/decrypt the contents * of the cache storage will also be granted to the same principal. * * @param identity The principal * @param objectsKeyPattern Restrict ...
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/cache-storage.ts#L136-L138
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
CacheStorage.grantDelete
public grantDelete(identity: iam.IGrantable, objectsKeyPattern?: any): iam.Grant { return (this.storage.grantDelete(identity, objectsKeyPattern)); }
/** * Grant delete permissions to the cache storage to an IAM principal. * * @param identity The principal * @param objectsKeyPattern Restrict the permission to a certain key pattern (default '*'). Parameter type is `any` but `string` should be passed in. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/cache-storage.ts#L146-L148
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
CacheStorage.grantPut
public grantPut(identity: iam.IGrantable, objectsKeyPattern?: any): iam.Grant { return (this.storage.grantPut(identity, objectsKeyPattern)); }
/** * Grants s3:PutObject* and s3:Abort* permissions for the bucket associated with * the cache storage to an IAM principal. * * If encryption is used, permission to use the key to encrypt the contents * of written files will also be granted to the same principal. * * @param identity The principal...
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/cache-storage.ts#L160-L162
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Service.constructor
constructor(scope: Construct, id: string, protected description: ServiceDescription) { super(scope, id); // Verifying whether the version is valid. if (!valid(description.version)) { throw new Error(`Semver value '${description.version}' is invalid`); } // Exporting the service attributes. ...
/** * Construct constructor. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/service.ts#L79-L104
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Service.serviceDescription
public serviceDescription(): ServiceDescription { return (this.description); }
/** * @returns the service description. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/service.ts#L109-L111
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Service.addProperty
public addProperty(key: string, value: string) { return (new ssm.StringParameter(this, key, { description: `Attribute '${key}' for service '${this.description.name}'.`, parameterName: `/services/${this.node.addr}/${this.description.name}/${this.description.version}/${key}`, stringValue: value ...
/** * Registers a new SSM parameter associated with the * given key and value. * @returns the newly created SSM parameter. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/service.ts#L118-L124
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Service.applyTrackingCode
private applyTrackingCode(serviceDescription: ServiceDescription, code: string) { const stack = cdk.Stack.of(this); const description = stack.templateOptions.description ?? ''; const fullDescription = TRACKING_REGEXP.exec(description); const tag = serviceDescription.name.split(TRACKING_TAG_SEPARATOR).jo...
/** * Adds the given tracking code to the stack description. * @param serviceDescription the service description. * @param code the tracking code to apply. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/service.ts#L131-L157
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Condition.constructor
constructor(subject: string) { this.negated = false; this.subject = subject; this.scope = this.createScope(subject); }
/** * Condition constructor. * @param subject the element in the message metadata * to apply the conditional statement on. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/dsl/vocabulary/conditions.ts#L58-L62
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Condition.createScope
private createScope(subject: string) { const paths = subject.split('.'); const value = {}; // Transform the key object path into a scope hierarchy and set // the subject to the last key. paths.reduce((scope: any, key) => { scope[key] = {}; return (scope[key]); }, value); return...
/** * Initializes the scope of the conditional statement. * The scope represents the hierarchy of objects used to * address a given attribute. * For example, in SNS filtering, the subject `foo.bar` will * result in the following scope : * * { * "foo": { * "bar": {} * } * } * ...
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/dsl/vocabulary/conditions.ts#L80-L92
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Condition.equals
public equals(value: string | number) { if (typeof value === 'string') { return (this.includes(value)); } else { if (this.negated) { throw new Error( 'Strict equal numeric value conditionals with the `not` operator are not supported by SNS.' ); } else { set(th...
/** * The `equals` operator allows to express strict equality * conditionals on a string or numeric value. * @param value the value to check the subject against. * @returns a new conditional statement. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/dsl/vocabulary/conditions.ts#L100-L113
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Condition.lt
public lt(value: number) { if (this.negated) { set(this.scope, this.subject, [{"numeric": [">=", value]}]); } else { set(this.scope, this.subject, [{"numeric": ["<", value]}]); } return (new ConditionalStatement(this.scope, this.subject)); }
/** * The `lt` operator allows to express a less than * conditional on a numeric value. * @param value the value to check the subject against. * @returns a new conditional statement. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/dsl/vocabulary/conditions.ts#L121-L128
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Condition.gt
public gt(value: number) { if (this.negated) { set(this.scope, this.subject, [{"numeric": ["<=", value]}]); } else { set(this.scope, this.subject, [{"numeric": [">", value]}]); } return (new ConditionalStatement(this.scope, this.subject)); }
/** * The `gt` operator allows to express a greater than * conditional on a numeric value. * @param value the value to check the subject against. * @returns a new conditional statement. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/dsl/vocabulary/conditions.ts#L136-L143
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Condition.lte
public lte(value: number) { return (this.not().gt(value)); }
/** * The `lte` operator allows to express a less than or * equal conditional on a numeric value. * @param value the value to check the subject against. * @returns a new conditional statement. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/dsl/vocabulary/conditions.ts#L151-L153
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Condition.gte
public gte(value: number) { return (this.not().lt(value)); }
/** * The `gte` operator allows to express a greater than or * equal conditional on a numeric value. * @param value the value to check the subject against. * @returns a new conditional statement. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/dsl/vocabulary/conditions.ts#L161-L163
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Condition.between
public between(operand_1: number, operand_2: number) { const gteOp: RangeOperator = '>='; const lteOp: RangeOperator = '<='; if (this.negated) { throw new Error('Range comparisons do not support the `not` operator.'); } set(this.scope, this.subject, [{"numeric": [gteOp, operand_1, lteOp, oper...
/** * The `between` operator allows to express a range * conditional on a numeric value. * @param value the value to check the subject against. * @returns a new conditional statement. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/dsl/vocabulary/conditions.ts#L171-L180
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Condition.includes
public includes(...values: string[] | number[]) { if (typeof values[0] === 'string') { if (this.negated) { set(this.scope, this.subject, [{"anything-but": [...values]}]); } else { set(this.scope, this.subject, [...values]); } } else { if (!this.negated) { throw ne...
/** * The `includes` operator allows to express a conditional * on a string or numeric set of values. * @param values the values to check the subject against. * @returns a new conditional statement. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/dsl/vocabulary/conditions.ts#L188-L202
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Condition.startsWith
public startsWith(value: string) { if (this.negated) { set(this.scope, this.subject, [{"anything-but": {"prefix": value}}]); } else { set(this.scope, this.subject, [{"prefix": value}]); } return (new ConditionalStatement(this.scope, this.subject)); }
/** * The `startsWith` operator allows to express a conditional * on a string prefix. * @param value the prefix to check the subject against. * @returns a new conditional statement. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/dsl/vocabulary/conditions.ts#L210-L217
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Condition.exists
public exists() { set(this.scope, this.subject, [{ exists: !this.negated }]); return (new ConditionalStatement(this.scope, this.subject)); }
/** * The `exists` operator allows to express a conditional * on the existence of a given attribute. * @returns a new conditional statement. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/dsl/vocabulary/conditions.ts#L224-L227
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Condition.not
public not() { this.negated = !this.negated; return (this); }
/** * The `not` operator allows to negate the current * conditional statement. * @returns the current conditional statement. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/dsl/vocabulary/conditions.ts#L234-L237
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Condition.isNegated
public isNegated() { return (this.negated); }
/** * @returns whether the current conditional statement * is negated. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/dsl/vocabulary/conditions.ts#L243-L245
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Condition.getScope
public getScope() { return (this.scope); }
/** * @returns the JSON representation of the current * conditional statement. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/dsl/vocabulary/conditions.ts#L251-L253
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Condition.getSubject
public getSubject() { return (this.subject); }
/** * @returns the subject of the conditional statement. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/dsl/vocabulary/conditions.ts#L258-L260
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
ConditionalStatement.empty
static empty() { return (new ConditionalStatement({}, '')); }
/** * @returns an empty conditional statement. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/dsl/vocabulary/conditions.ts#L279-L281
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
ConditionalStatement.and
public and(condition: ConditionalStatement) { const existing = get(this.aggregate, condition.subject()); if (existing) { throw new Error( `Cannot apply multiple conditions on the same subject: ${condition.subject()}` ); } merge(this.aggregate, condition.value()); return (this); ...
/** * The `and` operator allows to chain multiple conditions * on the same subject. * @param condition the condition to add to the current * conditional statement. * @returns the current conditional statement. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/dsl/vocabulary/conditions.ts#L290-L300
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
ConditionalStatement.value
public value() { return (this.aggregate); }
/** * @returns the SNS filtering syntax associated with * the conditional statement. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/dsl/vocabulary/conditions.ts#L306-L308
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
ConditionalStatement.subject
public subject() { return (this.subjectValue); }
/** * @returns the subject of the conditional statement. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/dsl/vocabulary/conditions.ts#L313-L315
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
ConditionalStatement.toJSON
public toJSON() { return (this.value()); }
/** * @returns the JSON representation of the conditional * statement. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/src/dsl/vocabulary/conditions.ts#L321-L323
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
DefaultMiddlewareBuilder.build
public build(): Middleware { return (new DefaultTestMiddleware( this.scope, this.identifier, { ...this.props } )); }
/** * @returns a new instance of the `TestMiddleware` * service constructed with the given parameters. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/test/unit/middleware/middleware-conditional.test.ts#L31-L38
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
ProducerMiddlewareBuilder.build
public build(): ProducerMiddleware { return (new ProducerMiddleware( this.scope, this.identifier, { ...this.props } )); }
/** * @returns a new instance of the `ProducerMiddleware` * service constructed with the given parameters. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/test/unit/middleware/middleware-connection.test.ts#L29-L36
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
ConsumerMiddlewareBuilder.build
public build(): ConsumerMiddleware { return (new ConsumerMiddleware( this.scope, this.identifier, { ...this.props } )); }
/** * @returns a new instance of the `ConsumerMiddleware` * service constructed with the given parameters. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/test/unit/middleware/middleware-connection.test.ts#L71-L78
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
TestMiddlewareBuilder.build
public build(): TestMiddleware { return (new TestMiddleware( this.scope, this.identifier, { ...this.props } )); }
/** * @returns a new instance of the `TestMiddleware` * service constructed with the given parameters. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/test/unit/middleware/middleware-defaults.test.ts#L46-L53
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
TestMiddlewareBuilder.build
public build(): TestMiddleware { return (new TestMiddleware( this.scope, this.identifier, { ...this.props } )); }
/** * @returns a new instance of the `TestMiddleware` * service constructed with the given parameters. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/core/test/unit/middleware/middleware-kms.test.ts#L31-L38
4285173e80584eedfc1a8424d3d1b6c1a7038088