Skip to content

Commit

Permalink
Fixed WorkflowManager event rule syntax
Browse files Browse the repository at this point in the history
* Suppressed with `@ts-ignore` for now as EventBridge able to accept the rule syntax.
  See aws/aws-cdk#30220
  • Loading branch information
victorskl authored and mmalenic committed Jul 3, 2024
1 parent 2b9b1e6 commit e069d35
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions lib/workload/stateless/stacks/workflow-manager/deploy/stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ import {
StackProps,
} from 'aws-cdk-lib';
import { PythonFunction, PythonLayerVersion } from '@aws-cdk/aws-lambda-python-alpha';
import { HttpLambdaIntegration } from 'aws-cdk-lib/aws-apigatewayv2-integrations';
import { HttpMethod, HttpRoute, HttpRouteKey } from 'aws-cdk-lib/aws-apigatewayv2';
import { PostgresManagerStack } from '../../../../stateful/stacks/postgres-manager/deploy/stack';
import { ManagedPolicy, Role, ServicePrincipal } from 'aws-cdk-lib/aws-iam';
import { ApiGwLogsConfig } from '../../../../components/api-gateway';
import { ApiGatewayProxyIntegration } from '../../../../components/api-gateway-proxy-integration';
import { ApiGatewayConstruct, ApiGwLogsConfig } from '../../../../components/api-gateway';

export interface WorkflowManagerStackProps extends StackProps {
lambdaSecurityGroupName: string;
Expand Down Expand Up @@ -119,14 +120,20 @@ export class WorkflowManagerStack extends Stack {
timeout: Duration.seconds(28),
});

new ApiGatewayProxyIntegration(this, 'ProxyIntegration', {
handler: apiFn,
apiGatewayProps: {
region: this.region,
apiName: 'WorkflowManager',
customDomainNamePrefix: 'workflow',
...props,
},
const wfmApi = new ApiGatewayConstruct(this, 'ApiGateway', {
region: this.region,
apiName: 'WorkflowManager',
customDomainNamePrefix: 'workflow',
...props,
});
const httpApi = wfmApi.httpApi;

const apiIntegration = new HttpLambdaIntegration('ApiIntegration', apiFn);

new HttpRoute(this, 'HttpRoute', {
httpApi: httpApi,
integration: apiIntegration,
routeKey: HttpRouteKey.with('/{proxy+}', HttpMethod.ANY),
});
}

Expand All @@ -147,7 +154,9 @@ export class WorkflowManagerStack extends Stack {

eventRule.addTarget(new aws_events_targets.LambdaFunction(procFn));
eventRule.addEventPattern({
source: ['{ "anything-but": "orcabus.workflowmanager" }'],
// See https://github.com/aws/aws-cdk/issues/30220
// @ts-ignore
source: [{ 'anything-but': 'orcabus.workflowmanager' }],
detailType: ['WorkflowRunStateChange'],
});
}
Expand Down

0 comments on commit e069d35

Please # to comment.