Skip to content

Commit f7ce0ee

Browse files
CCM-8861: Fix after bad rebase
1 parent d2ef3a5 commit f7ce0ee

File tree

8 files changed

+10
-33
lines changed

8 files changed

+10
-33
lines changed

infrastructure/terraform/modules/backend-api/module_lambda_send_letter_proof.tf

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,10 @@ module "lambda_send_letter_proof" {
3737
id = data.aws_vpc.account_vpc.id
3838
cidr_block = data.aws_vpc.account_vpc.cidr_block
3939
subnet_ids = data.aws_subnets.account_vpc_private_subnets.ids
40+
security_group_ids = [
41+
data.aws_security_group.account_vpc_sg_allow_sftp_egress.id
42+
]
4043
}
41-
42-
security_group_ids = [
43-
data.aws_security_group.account_vpc_sg_allow_sftp_egress.id
44-
]
4544
}
4645

4746
data "aws_iam_policy_document" "send_letter_proof" {

infrastructure/terraform/modules/lambda-function/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ No requirements.
1919
| <a name="input_log_retention_in_days"></a> [log\_retention\_in\_days](#input\_log\_retention\_in\_days) | Specifies the number of days you want to retain log events in the log group for this Lambda | `number` | `0` | no |
2020
| <a name="input_memory_size"></a> [memory\_size](#input\_memory\_size) | Lambda memory size | `number` | `128` | no |
2121
| <a name="input_runtime"></a> [runtime](#input\_runtime) | Identifier of the function's runtime | `string` | `"nodejs20.x"` | no |
22-
| <a name="input_security_group_ids"></a> [security\_group\_ids](#input\_security\_group\_ids) | n/a | `list(string)` | `[]` | no |
2322
| <a name="input_source_code_hash"></a> [source\_code\_hash](#input\_source\_code\_hash) | Base64-encoded SHA256 hash of the package file specified by `filename` | `string` | n/a | yes |
2423
| <a name="input_sqs_event_source_mapping"></a> [sqs\_event\_source\_mapping](#input\_sqs\_event\_source\_mapping) | Configuration for SQS event source mapping | <pre>object({<br/> sqs_queue_arn = string<br/> batch_size = optional(number, 10)<br/> maximum_batching_window_in_seconds = optional(number, 0)<br/> scaling_config = optional(object({<br/> maximum_concurrency = number<br/> }), null)<br/> })</pre> | `null` | no |
2524
| <a name="input_timeout"></a> [timeout](#input\_timeout) | Maximum running time before timeout | `number` | `3` | no |

lambdas/sftp-letters/src/__tests__/infra/sftp-supplier-client-repository.test.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { GetParameterCommand, SSMClient } from '@aws-sdk/client-ssm';
22
import { createMockLogger } from 'nhs-notify-web-template-management-test-helper-utils/mock-logger';
3-
import { ICache } from 'nhs-notify-web-template-management-utils';
43
import { mock } from 'jest-mock-extended';
54
import 'aws-sdk-client-mock-jest';
65
import { mockClient } from 'aws-sdk-client-mock';
@@ -10,13 +9,6 @@ import {
109
SftpSupplierClientRepository,
1110
} from '../../infra/sftp-supplier-client-repository';
1211
import { SftpClient } from '../../infra/sftp-client';
13-
import {
14-
GetParameterCommand,
15-
GetParametersByPathCommand,
16-
SSMClient,
17-
} from '@aws-sdk/client-ssm';
18-
import { createMockLogger } from 'nhs-notify-web-template-management-test-helper-utils/mock-logger';
19-
import { mock } from 'jest-mock-extended';
2012
import NodeCache from 'node-cache';
2113

2214
jest.mock('../../infra/sftp-client');
@@ -77,7 +69,6 @@ describe('getClient', () => {
7769
sftpClient: mockSftpClient,
7870
baseUploadDir: 'upload/dir',
7971
baseDownloadDir: 'download/dir',
80-
name: 'SYNERTEC',
8172
});
8273

8374
expect(cache.get).toHaveBeenCalledWith(credKey);
@@ -126,7 +117,6 @@ describe('getClient', () => {
126117
sftpClient: mockSftpClient,
127118
baseUploadDir: 'upload/dir',
128119
baseDownloadDir: 'download/dir',
129-
name: 'SYNERTEC',
130120
});
131121

132122
expect(cache.get).toHaveBeenCalledWith(credKey);

lambdas/sftp-letters/src/config/config-poll.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ import z from 'zod';
33
export function loadConfig() {
44
return z
55
.object({
6-
CREDENTIALS_TTL_MS: z.string().pipe(z.coerce.number()),
6+
CREDENTIALS_TTL_SECONDS: z.string().pipe(z.coerce.number()),
77
CSI: z.string(),
88
QUARANTINE_BUCKET_NAME: z.string(),
99
REGION: z.string(),
1010
SFTP_ENVIRONMENT: z.string(),
1111
})
1212
.transform((e) => ({
13-
credentialsTtlMs: e.CREDENTIALS_TTL_MS,
13+
credentialsTtlSeconds: e.CREDENTIALS_TTL_SECONDS,
1414
csi: e.CSI,
1515
quarantineBucketName: e.QUARANTINE_BUCKET_NAME,
1616
region: e.REGION,

lambdas/sftp-letters/src/container-poll.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@ import { SftpSupplierClientRepository } from './infra/sftp-supplier-client-repos
44
import { loadConfig } from './config/config-poll';
55
import { App } from './app/poll';
66
import { logger } from 'nhs-notify-web-template-management-utils/logger';
7-
import {
8-
InMemoryCache,
9-
S3Repository,
10-
} from 'nhs-notify-web-template-management-utils';
7+
import { S3Repository } from 'nhs-notify-web-template-management-utils';
8+
import NodeCache from 'node-cache';
119

1210
export function createContainer() {
1311
const {
1412
csi,
1513
quarantineBucketName,
16-
credentialsTtlMs,
14+
credentialsTtlSeconds,
1715
region,
1816
sftpEnvironment,
1917
} = loadConfig();
@@ -22,7 +20,7 @@ export function createContainer() {
2220

2321
const s3Client = new S3Client({ region });
2422

25-
const cache = new InMemoryCache({ ttl: credentialsTtlMs });
23+
const cache = new NodeCache({ stdTTL: credentialsTtlSeconds });
2624

2725
const sftpSupplierClientRepository = new SftpSupplierClientRepository(
2826
csi,

lambdas/sftp-letters/src/infra/sftp-supplier-client-repository.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ export class SftpSupplierClientRepository {
6969
sftpClient: new SftpClient(host, username, privateKey, hostKey),
7070
baseUploadDir,
7171
baseDownloadDir,
72-
name: supplier,
7372
};
7473
}
7574
}

utils/utils/src/__tests__/s3-repository.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import {
2-
PutObjectCommand,
3-
S3Client,
4-
} from '@aws-sdk/client-s3';
1+
import { PutObjectCommand, S3Client } from '@aws-sdk/client-s3';
52
import { mockClient } from 'aws-sdk-client-mock';
63
import 'aws-sdk-client-mock-jest';
74
import { mock } from 'jest-mock-extended';

utils/utils/src/s3-repository.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
PutObjectCommandInput,
44
PutObjectCommandOutput,
55
S3Client,
6-
_Object,
76
} from '@aws-sdk/client-s3';
87

98
export class S3Repository {
@@ -12,10 +11,6 @@ export class S3Repository {
1211
private readonly client: S3Client
1312
) {}
1413

15-
s3Path(key: string) {
16-
return `s3://${this.bucket}/${key}`;
17-
}
18-
1914
async putRawData(
2015
fileData: PutObjectCommandInput['Body'],
2116
key: string

0 commit comments

Comments
 (0)