Skip to content

chore(layers): add Idempotency, Batch, and Parameters to layer #1712

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions layers/src/canary-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ export class CanaryStack extends Stack {
'@aws-lambda-powertools/metrics',
'@aws-lambda-powertools/tracer',
'@aws-lambda-powertools/commons',
'@aws-lambda-powertools/parameters',
'@aws-lambda-powertools/idempotency',
'@aws-lambda-powertools/batch',
],
},
environment: {
Expand Down
10 changes: 9 additions & 1 deletion layers/src/layer-publisher-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,15 @@ export class LayerPublisherStack extends Stack {

// This is the list of packages that we need include in the Lambda Layer
// the name is the same as the npm workspace name
const utilities = ['commons', 'logger', 'metrics', 'tracer'];
const utilities = [
'commons',
'logger',
'metrics',
'tracer',
'parameters',
'idempotency',
'batch',
];

// These files are relative to the tmp folder
const filesToRemove = [
Expand Down
33 changes: 33 additions & 0 deletions layers/tests/e2e/layerPublisher.class.test.functionCode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,46 @@ import { readFile } from 'node:fs/promises';
import { Logger } from '@aws-lambda-powertools/logger';
import { Metrics } from '@aws-lambda-powertools/metrics';
import { Tracer } from '@aws-lambda-powertools/tracer';
import { DynamoDBPersistenceLayer } from '@aws-lambda-powertools/idempotency/dynamodb';
import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
import { BatchProcessor, EventType } from '@aws-lambda-powertools/batch';
import { SSMProvider } from '@aws-lambda-powertools/parameters/ssm';
import { SecretsProvider } from '@aws-lambda-powertools/parameters/secrets';
import { AppConfigProvider } from '@aws-lambda-powertools/parameters/appconfig';
import { DynamoDBProvider } from '@aws-lambda-powertools/parameters/dynamodb';
import { SSMClient } from '@aws-sdk/client-ssm';
import { SecretsManagerClient } from '@aws-sdk/client-secrets-manager';
import { AppConfigDataClient } from '@aws-sdk/client-appconfigdata';

const logger = new Logger({
logLevel: 'DEBUG',
});
const metrics = new Metrics();
const tracer = new Tracer();

const ddbClient = new DynamoDBClient({});

const ssmClient = new SSMClient({});

const secretsClient = new SecretsManagerClient({});

const appconfigClient = new AppConfigDataClient({});

new DynamoDBPersistenceLayer({
tableName: 'my-idempotency-table',
awsSdkV3Client: ddbClient,
});

new BatchProcessor(EventType.SQS);

new SSMProvider({ awsSdkV3Client: ssmClient });

new SecretsProvider({ awsSdkV3Client: secretsClient });

new AppConfigProvider({ environment: 'foo', awsSdkV3Client: appconfigClient });

new DynamoDBProvider({ tableName: 'foo', awsSdkV3Client: ddbClient });

const layerPath = process.env.LAYERS_PATH || '/opt/nodejs/node_modules';
const expectedVersion = process.env.POWERTOOLS_PACKAGE_VERSION || '0.0.0';

Expand Down
3 changes: 3 additions & 0 deletions layers/tests/e2e/layerPublisher.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ describe(`Layers E2E tests, publisher stack`, () => {
'@aws-lambda-powertools/logger',
'@aws-lambda-powertools/metrics',
'@aws-lambda-powertools/tracer',
'@aws-lambda-powertools/parameter',
'@aws-lambda-powertools/idempotency',
'@aws-lambda-powertools/batch',
],
},
layers: [layerVersion],
Expand Down