diff --git a/config/constants.ts b/config/constants.ts index 6fe13d9ab..b9cdbae8e 100644 --- a/config/constants.ts +++ b/config/constants.ts @@ -1,12 +1,10 @@ import { OrcaBusStatefulConfig } from '../lib/workload/orcabus-stateful-stack'; import { AuroraPostgresEngineVersion } from 'aws-cdk-lib/aws-rds'; -import { - FilemanagerDependencies, - OrcaBusStatelessConfig, -} from '../lib/workload/orcabus-stateless-stack'; +import { OrcaBusStatelessConfig } from '../lib/workload/orcabus-stateless-stack'; import { Duration, RemovalPolicy } from 'aws-cdk-lib'; import { EventSourceProps } from '../lib/workload/stateful/event_source/component'; import { DbAuthType } from '../lib/workload/stateless/postgres_manager/function/type'; +import { FilemanagerConfig } from '../lib/workload/stateless/filemanager/deploy/lib/filemanager'; const regName = 'OrcaBusSchemaRegistry'; const eventBusName = 'OrcaBusMain'; @@ -14,6 +12,11 @@ const lambdaSecurityGroupName = 'OrcaBusLambdaSecurityGroup'; const dbClusterIdentifier = 'orcabus-db'; const dbClusterResourceIdParameterName = '/orcabus/db-cluster-resource-id'; +const eventSourceQueueName = 'orcabus-event-source-queue'; +const devBucket = 'umccr-temp-dev'; +const stgBucket = 'umccr-temp-stg'; +const prodBucket = 'org.umccr.data.oncoanalyser'; + // Note, this should not end with a hyphen and 6 characters, otherwise secrets manager won't be // able to find the secret using a partial ARN. const rdsMasterSecretName = 'orcabus/master-rds'; // pragma: allowlist secret @@ -87,20 +90,24 @@ const orcaBusStatelessConfig = { }, }; -const eventSourceConfig: EventSourceProps = { - queueName: 'orcabus-event-source-queue', - maxReceiveCount: 3, - rules: [ - { - bucket: 'umccr-temp-dev', - }, - ], +const eventSourceConfig = (bucket: string): EventSourceProps => { + return { + queueName: eventSourceQueueName, + maxReceiveCount: 3, + rules: [ + { + bucket, + }, + ], + }; }; -const filemanagerDependencies: FilemanagerDependencies = { - eventSourceBuckets: ['umccr-temp-dev'], - eventSourceQueueName: eventSourceConfig.queueName, - databaseSecretName: orcaBusStatefulConfig.databaseProps.masterSecretName, +const filemanagerConfig = (bucket: string): FilemanagerConfig => { + return { + eventSourceQueueName: eventSourceQueueName, + databaseSecretName: orcaBusStatefulConfig.databaseProps.masterSecretName, + eventSourceBuckets: [bucket], + }; }; interface EnvironmentConfig { @@ -152,11 +159,11 @@ export const getEnvironmentConfig = ( securityGroupProps: { ...orcaBusStatefulConfig.securityGroupProps, }, - eventSourceProps: eventSourceConfig, + eventSourceProps: eventSourceConfig(devBucket), }, orcaBusStatelessConfig: { ...orcaBusStatelessConfig, - filemanagerDependencies: filemanagerDependencies, + filemanagerConfig: filemanagerConfig(devBucket), }, }, }; @@ -186,8 +193,12 @@ export const getEnvironmentConfig = ( securityGroupProps: { ...orcaBusStatefulConfig.securityGroupProps, }, + eventSourceProps: eventSourceConfig(stgBucket), + }, + orcaBusStatelessConfig: { + ...orcaBusStatelessConfig, + filemanagerConfig: filemanagerConfig(stgBucket), }, - orcaBusStatelessConfig: orcaBusStatelessConfig, }, }; break; @@ -214,8 +225,12 @@ export const getEnvironmentConfig = ( securityGroupProps: { ...orcaBusStatefulConfig.securityGroupProps, }, + eventSourceProps: eventSourceConfig(prodBucket), + }, + orcaBusStatelessConfig: { + ...orcaBusStatelessConfig, + filemanagerConfig: filemanagerConfig(prodBucket), }, - orcaBusStatelessConfig: orcaBusStatelessConfig, }, }; break; diff --git a/lib/workload/stateless/functions/cdk_resource_invoke.ts b/lib/workload/components/cdk_resource_invoke.ts similarity index 92% rename from lib/workload/stateless/functions/cdk_resource_invoke.ts rename to lib/workload/components/cdk_resource_invoke.ts index a440d9556..ab127dab7 100644 --- a/lib/workload/stateless/functions/cdk_resource_invoke.ts +++ b/lib/workload/components/cdk_resource_invoke.ts @@ -36,7 +36,7 @@ export type FunctionName = { * Function name. */ functionName: string; -} +}; /** * Props for the resource invoke construct. @@ -101,7 +101,7 @@ export class CdkResourceInvoke extends Construct { action: 'invoke', parameters: { FunctionName: this.function.functionName, - ...(props.payload && { Payload: props.payload }) + ...(props.payload && { Payload: props.payload }), }, physicalResourceId: PhysicalResourceId.of( `${id}-AwsSdkCall-${this.function.currentVersion + this.hashValue(props.payload)}` @@ -111,13 +111,10 @@ export class CdkResourceInvoke extends Construct { const role = new Role(this, 'AwsCustomResourceRole', { assumedBy: new ServicePrincipal('lambda.amazonaws.com'), }); + const lambdaResource = `arn:aws:lambda:${stack.region}:${stack.account}:function:${stackHash}-ResourceInvokeFunction-${props.id}`; role.addToPolicy( new PolicyStatement({ - resources: [ - // This needs to have permissions to run any `ResourceInvokeFunction` because it is deployed as a - // singleton Lambda function. - `arn:aws:lambda:${stack.region}:${stack.account}:function:${stackHash}-ResourceInvokeFunction-*`, - ], + resources: [lambdaResource], actions: ['lambda:InvokeFunction'], }) ); @@ -128,11 +125,12 @@ export class CdkResourceInvoke extends Construct { this._customResource = new AwsCustomResource(this, 'AwsCustomResource', { policy: AwsCustomResourcePolicy.fromSdkCalls({ - resources: AwsCustomResourcePolicy.ANY_RESOURCE, + resources: [lambdaResource], }), onUpdate: sdkCall, role: role, vpc: props.vpc, + installLatestAwsSdk: true, vpcSubnets: { subnetType: SubnetType.PRIVATE_WITH_EGRESS }, }); diff --git a/lib/workload/orcabus-stateless-stack.ts b/lib/workload/orcabus-stateless-stack.ts index 8940bda8d..e7a7aae72 100644 --- a/lib/workload/orcabus-stateless-stack.ts +++ b/lib/workload/orcabus-stateless-stack.ts @@ -4,7 +4,7 @@ import { Construct } from 'constructs'; import { getVpc } from './stateful/vpc/component'; import { MultiSchemaConstructProps } from './stateless/schema/component'; import { IVpc, ISecurityGroup, SecurityGroup } from 'aws-cdk-lib/aws-ec2'; -import { Filemanager } from './stateless/filemanager/deploy/lib/filemanager'; +import { Filemanager, FilemanagerConfig } from './stateless/filemanager/deploy/lib/filemanager'; import { Queue } from 'aws-cdk-lib/aws-sqs'; import { Secret } from 'aws-cdk-lib/aws-secretsmanager'; import { @@ -20,22 +20,7 @@ export interface OrcaBusStatelessConfig { lambdaSecurityGroupName: string; rdsMasterSecretName: string; postgresManagerConfig: PostgresManagerConfig; - filemanagerDependencies?: FilemanagerDependencies; -} - -export interface FilemanagerDependencies { - /** - * Queue name used by the EventSource construct. - */ - eventSourceQueueName: string; - /** - * Buckets defined by the EventSource construct. - */ - eventSourceBuckets: string[]; - /** - * Database secret name for the filemanager. - */ - databaseSecretName: string; + filemanagerConfig: FilemanagerConfig; } export class OrcaBusStatelessStack extends cdk.Stack { @@ -70,13 +55,7 @@ export class OrcaBusStatelessStack extends cdk.Stack { this.microserviceStackArray.push(this.createSequenceRunManager(props)); this.microserviceStackArray.push(this.createPostgresManager(props.postgresManagerConfig)); - - if (props.filemanagerDependencies) { - this.createFilemanager({ - ...props.filemanagerDependencies, - lambdaSecurityGroupName: props.lambdaSecurityGroupName, - }); - } + this.microserviceStackArray.push(this.createFilemanager(props.filemanagerConfig)); } private createSequenceRunManager(props: cdk.StackProps) { @@ -96,38 +75,30 @@ export class OrcaBusStatelessStack extends cdk.Stack { }); } - private createFilemanager( - dependencies: FilemanagerDependencies & { lambdaSecurityGroupName: string } - ) { + private createFilemanager(config: FilemanagerConfig) { // Opting to reconstruct the dependencies here, and pass them into the service as constructs. const queue = Queue.fromQueueArn( this, 'FilemanagerQueue', Arn.format( { - resource: dependencies.eventSourceQueueName, + resource: config.eventSourceQueueName, service: 'sqs', }, this ) ); - const databaseSecurityGroup = SecurityGroup.fromLookupByName( - this, - 'FilemanagerDatabaseSecurityGroup', - dependencies.lambdaSecurityGroupName, - this.vpc - ); const databaseSecret = Secret.fromSecretNameV2( this, 'FilemanagerDatabaseSecret', - dependencies.databaseSecretName + config.databaseSecretName ); return new Filemanager(this, 'Filemanager', { - buckets: dependencies.eventSourceBuckets, + buckets: config.eventSourceBuckets, buildEnvironment: {}, databaseSecret, - databaseSecurityGroup, + databaseSecurityGroup: this.lambdaSecurityGroup, eventSources: [queue], migrateDatabase: true, vpc: this.vpc, diff --git a/lib/workload/stateful/event_source/component.ts b/lib/workload/stateful/event_source/component.ts index 3df7e30c5..e264954e1 100644 --- a/lib/workload/stateful/event_source/component.ts +++ b/lib/workload/stateful/event_source/component.ts @@ -55,9 +55,10 @@ export class EventSource extends Construct { constructor(scope: Construct, id: string, props: EventSourceProps) { super(scope, id); - this.deadLetterQueue = new Queue(this, 'DeadLetterQueue'); + this.deadLetterQueue = new Queue(this, 'DeadLetterQueue', { enforceSSL: true }); this.queue = new Queue(this, 'Queue', { queueName: props.queueName, + enforceSSL: true, deadLetterQueue: { maxReceiveCount: props.maxReceiveCount, queue: this.deadLetterQueue, diff --git a/lib/workload/stateless/filemanager/Cargo.lock b/lib/workload/stateless/filemanager/Cargo.lock index 5d6a6889e..2a9cff897 100644 --- a/lib/workload/stateless/filemanager/Cargo.lock +++ b/lib/workload/stateless/filemanager/Cargo.lock @@ -32,9 +32,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] @@ -188,9 +188,9 @@ dependencies = [ [[package]] name = "aws-sdk-s3" -version = "1.19.1" +version = "1.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54dd36a773ad90e8ae6b8464e51af0312b5422418ae1fd80c7a647975e1846b6" +checksum = "c2090d4e1455988a3a09a3a695c66de0feef49ebbc3f87bf49a7344308bc5656" dependencies = [ "ahash", "aws-credential-types", @@ -434,7 +434,7 @@ dependencies = [ "aws-smithy-types", "bytes", "fastrand", - "h2 0.3.25", + "h2", "http 0.2.12", "http-body 0.4.6", "hyper 0.14.28", @@ -513,16 +513,16 @@ dependencies = [ [[package]] name = "aws_lambda_events" -version = "0.12.1" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03611508dd1e514e311caec235b581c99a4cb66fa1771bd502819eed69894f12" +checksum = "598e2ade8447dce8d3a15b6159b73354db34257851344b232fb1920c272acc61" dependencies = [ - "base64 0.21.7", + "base64", "bytes", "chrono", "flate2", - "http 0.2.12", - "http-body 0.4.6", + "http 1.1.0", + "http-body 1.0.0", "http-serde", "query_map", "serde", @@ -531,60 +531,11 @@ dependencies = [ "serde_with", ] -[[package]] -name = "axum" -version = "0.6.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" -dependencies = [ - "async-trait", - "axum-core", - "bitflags 1.3.2", - "bytes", - "futures-util", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.28", - "itoa", - "matchit", - "memchr", - "mime", - "percent-encoding", - "pin-project-lite", - "rustversion", - "serde", - "serde_json", - "serde_path_to_error", - "serde_urlencoded", - "sync_wrapper", - "tokio", - "tower", - "tower-layer", - "tower-service", -] - -[[package]] -name = "axum-core" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" -dependencies = [ - "async-trait", - "bytes", - "futures-util", - "http 0.2.12", - "http-body 0.4.6", - "mime", - "rustversion", - "tower-layer", - "tower-service", -] - [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "95d8e92cac0961e91dbd517496b00f7e9b92363dbe6d42c3198268323798860c" dependencies = [ "addr2line", "cc", @@ -601,12 +552,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" -[[package]] -name = "base64" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ea22880d78093b0cbe17c89f64a7d457941e65759157ec6cb31a31d652b05e5" - [[package]] name = "base64" version = "0.21.7" @@ -637,9 +582,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" dependencies = [ "serde", ] @@ -900,27 +845,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "dirs" -version = "5.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" -dependencies = [ - "libc", - "option-ext", - "redox_users", - "windows-sys 0.48.0", -] - [[package]] name = "dotenvy" version = "0.15.7" @@ -1042,12 +966,10 @@ dependencies = [ "aws-sdk-sqs", "aws-smithy-runtime-api", "aws_lambda_events", - "axum", "chrono", "dotenvy", "filemanager", "futures", - "hyper 1.2.0", "itertools", "lambda_runtime", "lazy_static", @@ -1058,12 +980,7 @@ dependencies = [ "sqlx", "thiserror", "tokio", - "tower", - "tower-http", "tracing", - "tracing-subscriber", - "utoipa", - "utoipa-swagger-ui", "uuid", ] @@ -1071,11 +988,9 @@ dependencies = [ name = "filemanager-http-lambda" version = "0.1.0" dependencies = [ - "axum", "filemanager", "lambda_http", "lambda_runtime", - "serde_json", "tokio", "tracing", "tracing-subscriber", @@ -1085,13 +1000,9 @@ dependencies = [ name = "filemanager-ingest-lambda" version = "0.1.0" dependencies = [ - "aws-config", - "aws-sdk-sts", "aws_lambda_events", "filemanager", "lambda_runtime", - "serde", - "serde_json", "tokio", "tracing", "tracing-subscriber", @@ -1101,13 +1012,9 @@ dependencies = [ name = "filemanager-migrate-lambda" version = "0.1.0" dependencies = [ - "aws-config", - "aws-sdk-sts", "aws_lambda_events", "filemanager", "lambda_runtime", - "serde", - "serde_json", "tokio", "tracing", "tracing-subscriber", @@ -1318,25 +1225,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "h2" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51ee2dd2e4f378392eeff5d51618cd9a63166a2513846bbc55f21cfacd9199d4" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http 1.1.0", - "indexmap 2.2.5", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "hashbrown" version = "0.12.3" @@ -1454,18 +1342,25 @@ dependencies = [ ] [[package]] -name = "http-range-header" -version = "0.3.1" +name = "http-body-util" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "add0ab9360ddbd88cfeb3bd9574a1d85cfdfa14db10b3e21d3700dbc4328758f" +checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" +dependencies = [ + "bytes", + "futures-core", + "http 1.1.0", + "http-body 1.0.0", + "pin-project-lite", +] [[package]] name = "http-serde" -version = "1.1.3" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f560b665ad9f1572cfcaf034f7fb84338a7ce945216d64a90fd81f046a3caee" +checksum = "7fb7239a6d49eda628c2dfdd7e982c59b0c3f0fb99ce45c4237f02a520030688" dependencies = [ - "http 0.2.12", + "http 1.1.0", "serde", ] @@ -1491,7 +1386,7 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2 0.3.25", + "h2", "http 0.2.12", "http-body 0.4.6", "httparse", @@ -1514,11 +1409,9 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "h2 0.4.3", "http 1.1.0", "http-body 1.0.0", "httparse", - "httpdate", "itoa", "pin-project-lite", "smallvec", @@ -1542,6 +1435,26 @@ dependencies = [ "tokio-rustls", ] +[[package]] +name = "hyper-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.1.0", + "http-body 1.0.0", + "hyper 1.2.0", + "pin-project-lite", + "socket2", + "tokio", + "tower", + "tower-service", + "tracing", +] + [[package]] name = "iana-time-zone" version = "0.1.60" @@ -1629,21 +1542,24 @@ dependencies = [ [[package]] name = "lambda_http" -version = "0.8.3" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2505c4a24f5a8d8ac66a87691215ec1f79736c5bc6e62bb921788dca9753f650" +checksum = "ef8fafd7a4ce0bc6093cf1bed3dcdfc1239c27df1e79e3f2154f4d3299d4f60e" dependencies = [ "aws_lambda_events", - "base64 0.21.7", + "base64", "bytes", "encoding_rs", "futures", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.28", + "futures-util", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", + "hyper 1.2.0", "lambda_runtime", "mime", "percent-encoding", + "pin-project-lite", "serde", "serde_json", "serde_urlencoded", @@ -1653,18 +1569,20 @@ dependencies = [ [[package]] name = "lambda_runtime" -version = "0.8.3" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "deca8f65d7ce9a8bfddebb49d7d91b22e788a59ca0c5190f26794ab80ed7a702" +checksum = "cc2904c10fbeaf07aa317fc96a0e28e89c80ed12f7949ed06afd7869b21fef32" dependencies = [ "async-stream", - "base64 0.20.0", + "base64", "bytes", "futures", - "http 0.2.12", - "http-body 0.4.6", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", "http-serde", - "hyper 0.14.28", + "hyper 1.2.0", + "hyper-util", "lambda_runtime_api_client", "serde", "serde_json", @@ -1677,14 +1595,23 @@ dependencies = [ [[package]] name = "lambda_runtime_api_client" -version = "0.8.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "690c5ae01f3acac8c9c3348b556fc443054e9b7f1deaf53e9ebab716282bf0ed" +checksum = "1364cd67281721d2a9a4444ba555cf4d74a195e647061fa4ccac46e6f5c3b0ae" dependencies = [ - "http 0.2.12", - "hyper 0.14.28", + "bytes", + "futures-channel", + "futures-util", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", + "hyper 1.2.0", + "hyper-util", "tokio", + "tower", "tower-service", + "tracing", + "tracing-subscriber", ] [[package]] @@ -1708,17 +1635,6 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" -[[package]] -name = "libredox" -version = "0.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" -dependencies = [ - "bitflags 2.4.2", - "libc", - "redox_syscall", -] - [[package]] name = "libsqlite3-sys" version = "0.27.0" @@ -1770,12 +1686,6 @@ dependencies = [ "regex-automata 0.1.10", ] -[[package]] -name = "matchit" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" - [[package]] name = "md-5" version = "0.10.6" @@ -1798,16 +1708,6 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" -[[package]] -name = "mime_guess" -version = "2.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" -dependencies = [ - "mime", - "unicase", -] - [[package]] name = "minimal-lexical" version = "0.2.1" @@ -1883,16 +1783,6 @@ dependencies = [ "minimal-lexical", ] -[[package]] -name = "nu-ansi-term" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" -dependencies = [ - "overload", - "winapi", -] - [[package]] name = "num-bigint-dig" version = "0.8.4" @@ -1977,24 +1867,12 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" -[[package]] -name = "option-ext" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" - [[package]] name = "outref" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4030760ffd992bef45b0ae3f10ce1aba99e33464c90d14dd7c039884963ddc7a" -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - [[package]] name = "p256" version = "0.11.1" @@ -2157,30 +2035,6 @@ dependencies = [ "termtree", ] -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - [[package]] name = "proc-macro2" version = "1.0.79" @@ -2249,17 +2103,6 @@ dependencies = [ "bitflags 1.3.2", ] -[[package]] -name = "redox_users" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" -dependencies = [ - "getrandom", - "libredox", - "thiserror", -] - [[package]] name = "regex" version = "1.10.3" @@ -2356,41 +2199,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "rust-embed" -version = "8.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb78f46d0066053d16d4ca7b898e9343bc3530f71c61d5ad84cd404ada068745" -dependencies = [ - "rust-embed-impl", - "rust-embed-utils", - "walkdir", -] - -[[package]] -name = "rust-embed-impl" -version = "8.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91ac2a3c6c0520a3fb3dd89321177c3c692937c4eb21893378219da10c44fc8" -dependencies = [ - "proc-macro2", - "quote", - "rust-embed-utils", - "shellexpand", - "syn 2.0.53", - "walkdir", -] - -[[package]] -name = "rust-embed-utils" -version = "8.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f69089032567ffff4eada41c573fc43ff466c7db7c5688b2e7969584345581" -dependencies = [ - "sha2", - "walkdir", -] - [[package]] name = "rustc-demangle" version = "0.1.23" @@ -2408,11 +2216,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.31" +version = "0.38.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" +checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "errno", "libc", "linux-raw-sys", @@ -2449,7 +2257,7 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ - "base64 0.21.7", + "base64", ] [[package]] @@ -2462,27 +2270,12 @@ dependencies = [ "untrusted", ] -[[package]] -name = "rustversion" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" - [[package]] name = "ryu" version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - [[package]] name = "schannel" version = "0.1.23" @@ -2577,7 +2370,7 @@ version = "4.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b652e4dd5549c24a4ec779981278cccae2f85b4d5649441c745d58866e20283" dependencies = [ - "base64 0.21.7", + "base64", "serde", ] @@ -2620,7 +2413,7 @@ version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee80b0e361bbf88fd2f6e242ccd19cfda072cb0faa6ae694ecee08199938569a" dependencies = [ - "base64 0.21.7", + "base64", "chrono", "hex", "indexmap 1.9.3", @@ -2675,15 +2468,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "shellexpand" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da03fa3b94cc19e3ebfc88c4229c49d8f08cdbd1228870a45f0ffdf84988e14b" -dependencies = [ - "dirs", -] - [[package]] name = "signal-hook-registry" version = "1.4.1" @@ -2724,9 +2508,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" @@ -2887,8 +2671,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ed31390216d20e538e447a7a9b959e06ed9fc51c37b514b46eb758016ecd418" dependencies = [ "atoi", - "base64 0.21.7", - "bitflags 2.4.2", + "base64", + "bitflags 2.5.0", "byteorder", "bytes", "chrono", @@ -2931,8 +2715,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c824eb80b894f926f89a0b9da0c7f435d27cdd35b8c655b114e58223918577e" dependencies = [ "atoi", - "base64 0.21.7", - "bitflags 2.4.2", + "base64", + "bitflags 2.5.0", "byteorder", "chrono", "crc", @@ -3034,12 +2818,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "sync_wrapper" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" - [[package]] name = "tempfile" version = "3.10.1" @@ -3214,25 +2992,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "tower-http" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140" -dependencies = [ - "bitflags 2.4.2", - "bytes", - "futures-core", - "futures-util", - "http 0.2.12", - "http-body 0.4.6", - "http-range-header", - "pin-project-lite", - "tower-layer", - "tower-service", - "tracing", -] - [[package]] name = "tower-layer" version = "0.3.2" @@ -3278,17 +3037,6 @@ dependencies = [ "valuable", ] -[[package]] -name = "tracing-log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" -dependencies = [ - "log", - "once_cell", - "tracing-core", -] - [[package]] name = "tracing-serde" version = "0.1.3" @@ -3306,17 +3054,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" dependencies = [ "matchers", - "nu-ansi-term", "once_cell", "regex", "serde", "serde_json", "sharded-slab", - "smallvec", "thread_local", "tracing", "tracing-core", - "tracing-log", "tracing-serde", ] @@ -3332,15 +3077,6 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" -[[package]] -name = "unicase" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" -dependencies = [ - "version_check", -] - [[package]] name = "unicode-bidi" version = "0.3.15" @@ -3397,52 +3133,11 @@ version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" -[[package]] -name = "utoipa" -version = "4.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "272ebdfbc99111033031d2f10e018836056e4d2c8e2acda76450ec7974269fa7" -dependencies = [ - "indexmap 2.2.5", - "serde", - "serde_json", - "utoipa-gen", -] - -[[package]] -name = "utoipa-gen" -version = "4.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3c9f4d08338c1bfa70dde39412a040a884c6f318b3d09aaaf3437a1e52027fc" -dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "regex", - "syn 2.0.53", -] - -[[package]] -name = "utoipa-swagger-ui" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "154517adf0d0b6e22e8e1f385628f14fcaa3db43531dc74303d3edef89d6dfe5" -dependencies = [ - "axum", - "mime_guess", - "regex", - "rust-embed", - "serde", - "serde_json", - "utoipa", - "zip", -] - [[package]] name = "uuid" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" +checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" dependencies = [ "atomic", "getrandom", @@ -3472,16 +3167,6 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c3082ca00d5a5ef149bb8b555a72ae84c9c59f7250f013ac822ac2e49b19c64" -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - [[package]] name = "want" version = "0.3.1" @@ -3573,37 +3258,6 @@ dependencies = [ "wasite", ] -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" -dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - [[package]] name = "windows-core" version = "0.52.0" @@ -3776,15 +3430,3 @@ name = "zeroize" version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" - -[[package]] -name = "zip" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" -dependencies = [ - "byteorder", - "crc32fast", - "crossbeam-utils", - "flate2", -] diff --git a/lib/workload/stateless/filemanager/Cargo.toml b/lib/workload/stateless/filemanager/Cargo.toml index 40e4c7565..fe3f40e58 100644 --- a/lib/workload/stateless/filemanager/Cargo.toml +++ b/lib/workload/stateless/filemanager/Cargo.toml @@ -12,3 +12,4 @@ members = [ license = "MIT" edition = "2021" authors = ["Marko Malenic ", "Roman Valls Guimera "] +rust-version = "1.74" diff --git a/lib/workload/stateless/filemanager/deploy/constructs/functions/function.ts b/lib/workload/stateless/filemanager/deploy/constructs/functions/function.ts index 8990e852f..82500e740 100644 --- a/lib/workload/stateless/filemanager/deploy/constructs/functions/function.ts +++ b/lib/workload/stateless/filemanager/deploy/constructs/functions/function.ts @@ -118,7 +118,7 @@ export class Function extends Construct { RUST_LOG: props.rustLog ?? `info,${props.package.replace('-', '_')}=trace,filemanager=trace`, }, - architecture: Architecture.X86_64, + architecture: Architecture.ARM_64, role: this._role, vpc: props.vpc, vpcSubnets: { subnetType: SubnetType.PRIVATE_WITH_EGRESS }, diff --git a/lib/workload/stateless/filemanager/deploy/constructs/functions/ingest.ts b/lib/workload/stateless/filemanager/deploy/constructs/functions/ingest.ts index 9af453e2f..9e2ba4417 100644 --- a/lib/workload/stateless/filemanager/deploy/constructs/functions/ingest.ts +++ b/lib/workload/stateless/filemanager/deploy/constructs/functions/ingest.ts @@ -34,8 +34,8 @@ export class IngestFunction extends fn.Function { }); props.buckets.map((bucket) => { this.addToPolicy(new PolicyStatement({ - actions: ['s3:List*', 's3:Get*'], - resources: [`arn:aws:s3:::${bucket}/*`], + actions: ['s3:ListBucket', 's3:GetObject'], + resources: [`arn:aws:s3:::${bucket}`, `arn:aws:s3:::${bucket}/*`], })); }) } diff --git a/lib/workload/stateless/filemanager/deploy/lib/filemanager.ts b/lib/workload/stateless/filemanager/deploy/lib/filemanager.ts index fd051fc09..a70ed5471 100644 --- a/lib/workload/stateless/filemanager/deploy/lib/filemanager.ts +++ b/lib/workload/stateless/filemanager/deploy/lib/filemanager.ts @@ -1,16 +1,35 @@ import { Construct } from 'constructs'; import { IngestFunction, IngestFunctionProps } from '../constructs/functions/ingest'; -import { CdkResourceInvoke } from '../../../functions/cdk_resource_invoke'; import { MigrateFunction } from '../constructs/functions/migrate'; import * as fn from '../constructs/functions/function'; import { IVpc } from 'aws-cdk-lib/aws-ec2'; import { IQueue } from 'aws-cdk-lib/aws-sqs'; import { DatabaseProps } from '../constructs/functions/function'; +import { Stack, StackProps } from 'aws-cdk-lib'; +import { CdkResourceInvoke } from '../../../../components/cdk_resource_invoke'; + +/** + * Stateful config for filemanager. + */ +export type FilemanagerConfig = { + /** + * Queue name used by the EventSource construct. + */ + eventSourceQueueName: string; + /** + * Buckets defined by the EventSource construct. + */ + eventSourceBuckets: string[]; + /** + * Database secret name for the filemanager. + */ + databaseSecretName: string; +} /** * Props for the filemanager stack. */ -type FilemanagerProps = IngestFunctionProps & DatabaseProps & { +type FilemanagerProps = StackProps & IngestFunctionProps & DatabaseProps & { /** * VPC to use for filemanager. */ @@ -33,9 +52,9 @@ type FilemanagerProps = IngestFunctionProps & DatabaseProps & { /** * Construct used to configure the filemanager. */ -export class Filemanager extends Construct { +export class Filemanager extends Stack { constructor(scope: Construct, id: string, props: FilemanagerProps) { - super(scope, id); + super(scope, id, props); if (props?.migrateDatabase) { new CdkResourceInvoke(this, 'MigrateDatabase', { diff --git a/lib/workload/stateless/filemanager/filemanager-http-lambda/Cargo.toml b/lib/workload/stateless/filemanager/filemanager-http-lambda/Cargo.toml index e6e87cc35..2a54a59c2 100644 --- a/lib/workload/stateless/filemanager/filemanager-http-lambda/Cargo.toml +++ b/lib/workload/stateless/filemanager/filemanager-http-lambda/Cargo.toml @@ -5,15 +5,14 @@ version = "0.1.0" license.workspace = true edition.workspace = true authors.workspace = true +rust-version.workspace = true [dependencies] -lambda_http = "0.8" -lambda_runtime = "0.8" tokio = { version = "1", features = ["macros"] } tracing = { version = "0.1", features = ["log"] } tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt"] } -axum = "0.6" -serde_json = "1.0" +lambda_http = "0.10" +lambda_runtime = "0.10" filemanager = { path = "../filemanager" } diff --git a/lib/workload/stateless/filemanager/filemanager-ingest-lambda/Cargo.toml b/lib/workload/stateless/filemanager/filemanager-ingest-lambda/Cargo.toml index 2e1bc848b..584ce1f14 100644 --- a/lib/workload/stateless/filemanager/filemanager-ingest-lambda/Cargo.toml +++ b/lib/workload/stateless/filemanager/filemanager-ingest-lambda/Cargo.toml @@ -5,17 +5,14 @@ version = "0.1.0" license.workspace = true edition.workspace = true authors.workspace = true +rust-version.workspace = true [dependencies] -aws_lambda_events = "0.12" -lambda_runtime = "0.8" -serde = "1" tokio = { version = "1", features = ["macros"] } tracing = { version = "0.1", features = ["log"] } tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt"] } -filemanager = { path = "../filemanager" } -serde_json = "1" +aws_lambda_events = "0.15" +lambda_runtime = "0.10" -aws-config = "1" -aws-sdk-sts = "1" \ No newline at end of file +filemanager = { path = "../filemanager" } \ No newline at end of file diff --git a/lib/workload/stateless/filemanager/filemanager-migrate-lambda/Cargo.toml b/lib/workload/stateless/filemanager/filemanager-migrate-lambda/Cargo.toml index 13ee67f2b..8fb479560 100644 --- a/lib/workload/stateless/filemanager/filemanager-migrate-lambda/Cargo.toml +++ b/lib/workload/stateless/filemanager/filemanager-migrate-lambda/Cargo.toml @@ -4,17 +4,14 @@ version = "0.1.0" license.workspace = true edition.workspace = true authors.workspace = true +rust-version.workspace = true [dependencies] -aws_lambda_events = "0.12" -lambda_runtime = "0.8" -serde = "1" tokio = { version = "1", features = ["macros"] } tracing = { version = "0.1", features = ["log"] } tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt"] } -filemanager = { path = "../filemanager", features = ["migrate"] } -serde_json = "1" +aws_lambda_events = "0.15" +lambda_runtime = "0.10" -aws-config = "1" -aws-sdk-sts = "1" \ No newline at end of file +filemanager = { path = "../filemanager", features = ["migrate"] } \ No newline at end of file diff --git a/lib/workload/stateless/filemanager/filemanager/Cargo.toml b/lib/workload/stateless/filemanager/filemanager/Cargo.toml index c5cd093dd..543592167 100644 --- a/lib/workload/stateless/filemanager/filemanager/Cargo.toml +++ b/lib/workload/stateless/filemanager/filemanager/Cargo.toml @@ -5,46 +5,40 @@ version = "0.1.0" authors.workspace = true license.workspace = true edition.workspace = true +rust-version.workspace = true [features] migrate = ["sqlx/migrate"] [dependencies] -axum = "0.6" -hyper = { version = "1", features = ["full"] } serde = { version = "1", features = ["derive"] } serde_json = "1" sqlx = { version = "0.7", features = ["postgres", "runtime-tokio", "tls-rustls", "chrono", "uuid"] } + +async-trait = "0.1" +futures = "0.3" tokio = { version = "1", features = ["rt-multi-thread", "macros"] } -utoipa = { version = "4", features = ["axum_extras"] } -utoipa-swagger-ui = { version = "4", features = ["axum"] } tracing = "0.1" -tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] } -tower = "0.4" -tower-http = { version = "0.4", features = ["trace"] } + chrono = { version = "0.4", features = ["serde"] } dotenvy = "0.15" -thiserror = "1.0" -async-trait = "0.1" -uuid = { version = "1.7", features = ["v7"] } +thiserror = "1" +uuid = { version = "1", features = ["v7"] } mockall = "0.12" mockall_double = "0.3" -lambda_runtime = "0.8" -aws_lambda_events = "0.12" itertools = "0.12" -# AWS aws-sdk-sqs = "1" aws-config = "1" aws-sdk-s3 = "1" -futures = "0.3" -#lambda_http = "0.8.0" -#lambda_runtime = "0.8.0" +lambda_runtime = "0.10" +aws_lambda_events = "0.15" [dev-dependencies] +lazy_static = "1" + aws-smithy-runtime-api = "1" # The migrate feature is required to run sqlx tests -filemanager = { path = ".", features = ["migrate"] } -lazy_static = "1.4" +filemanager = { path = ".", features = ["migrate"] } \ No newline at end of file diff --git a/lib/workload/stateless/filemanager/filemanager/src/env.rs b/lib/workload/stateless/filemanager/filemanager/src/env.rs index 240234627..3575a6a36 100644 --- a/lib/workload/stateless/filemanager/filemanager/src/env.rs +++ b/lib/workload/stateless/filemanager/filemanager/src/env.rs @@ -1,13 +1,10 @@ //! Handle environment variables. //! +use dotenvy::dotenv; use std::ffi::OsStr; -use std::{ - env, - fmt::{self}, -}; +use std::{env, fmt}; -use dotenvy; use tracing::{error, info}; use crate::error::Error::MissingEnvironmentVariable; @@ -33,7 +30,7 @@ pub fn load_env() -> AppEnv { info!("Running in {app_env} mode"); if app_env == AppEnv::Dev { - match dotenvy::dotenv() { + match dotenv() { Ok(path) => info!(".env read successfully from {}", path.display()), Err(e) => error!("Could not load .env file: {e}"), }; diff --git a/test/stateless/cdkResourceInvoke.test.ts b/test/stateless/cdkResourceInvoke.test.ts index b397acdf1..05a97721b 100644 --- a/test/stateless/cdkResourceInvoke.test.ts +++ b/test/stateless/cdkResourceInvoke.test.ts @@ -1,8 +1,8 @@ import * as cdk from 'aws-cdk-lib'; import { Match, Template } from 'aws-cdk-lib/assertions'; -import { CdkResourceInvoke } from '../../lib/workload/stateless/functions/cdk_resource_invoke'; import * as ec2 from 'aws-cdk-lib/aws-ec2'; import * as lambda from 'aws-cdk-lib/aws-lambda'; +import { CdkResourceInvoke } from '../../lib/workload/components/cdk_resource_invoke'; let stack: cdk.Stack; let vpc: ec2.Vpc; @@ -62,7 +62,7 @@ test('Test CdkResourceInvoke', () => { Resource: { 'Fn::Join': [ '', - Match.arrayWith([`:function:${expectedHash}-ResourceInvokeFunction-*`]), + Match.arrayWith([`:function:${expectedHash}-ResourceInvokeFunction-TestFunction`]), ], }, }, diff --git a/test/stateless/stateless-deployment.test.ts b/test/stateless/stateless-deployment.test.ts index 3bb03111d..e63e45c6b 100644 --- a/test/stateless/stateless-deployment.test.ts +++ b/test/stateless/stateless-deployment.test.ts @@ -99,6 +99,17 @@ function applyNagSuppression(stackId: string, stack: Stack) { true ); + NagSuppressions.addStackSuppressions( + stack, + [ + { + id: 'AwsSolutions-L1', + reason: "'AwsCustomResource' is out of date", + }, + ], + true + ); + // for each stack specific switch (stackId) { @@ -117,6 +128,20 @@ function applyNagSuppression(stackId: string, stack: Stack) { ); break; + case 'Filemanager': + NagSuppressions.addResourceSuppressions( + stack, + [ + { + id: 'AwsSolutions-IAM5', + reason: "'*' is required to access objects in the indexed bucket by filemanager", + appliesTo: ['Resource::arn:aws:s3:::org.umccr.data.oncoanalyser/*'], + }, + ], + true + ); + break; + default: break; }