Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
protected bound(
scope: Construct,
_stage: IStage,
options: ActionBindOptions,
): ActionConfig {
const { parameterName, regExp, logParameter = false } = this.props;
const checkParameterFunction = new Function(
scope,
'CheckParamterFunction',
{
runtime: Runtime.PYTHON_3_7,
code: Code.fromAsset(`${LAMBDA_PATH}/check-parameter`),
handler: 'check_parameter.lambda_handler',
},
);
// allow pipeline to list functions
options.role.addToPolicy(
new PolicyStatement({
actions: ['lambda:ListFunctions'],
resources: ['*'],
}),
);
// allow pipeline to invoke this lambda functionn
options.role.addToPolicy(
new PolicyStatement({
actions: ['lambda:InvokeFunction'],
public constructor(
parent: Construct,
id: string,
props: GithubWebhookProps,
) {
super(parent, id);
const handler = new SingletonFunction(this, 'CustomResourceHandler', {
uuid: '83CBF3EB-7B62-44F2-8C67-8441E4C1232E',
runtime: Runtime.NODEJS_10_X,
code: Code.fromAsset(
path.join(__dirname, '..', 'lambda', 'bundle.zip'),
),
handler: 'lib/github-webhook.handler',
lambdaPurpose: 'Custom::GithubWebhook',
timeout: Duration.minutes(15),
});
const {
githubApiToken,
githubRepoUrl,
payloadUrl,
events,
logLevel,
} = props;
new CustomResource(this, 'CustomResource', {
public constructor(
scope: Construct,
id: string,
props: ContentfulWebhookProps,
) {
super(scope, id);
const handler = new SingletonFunction(this, 'CustomResourceHandler', {
uuid: '91f2075f-b950-4743-a66b-ee0f6febf50d',
runtime: Runtime.NODEJS_10_X,
code: Code.fromAsset(
path.join(__dirname, '..', 'lambda', 'bundle.zip'),
),
handler: 'lib/contentful-webhook.handler',
lambdaPurpose: 'Custom::ContentfulWebhook',
timeout: Duration.minutes(15),
});
new CustomResource(this, 'CustomResource', {
provider: CustomResourceProvider.lambda(handler),
resourceType: 'Custom::ContentfulWebhook',
properties: {
...props,
},
});
}
}
new PolicyStatement({
resources: ['*'],
actions: [
'codebuild:*',
'codecommit:*',
'logs:CreateLogGroup',
'logs:CreateLogStream',
'logs:PutLogEvents',
'logs:GetLogEvents',
],
}),
);
const pullRequestFunction = new Function(this, 'PullRequestFunction', {
runtime: Runtime.PYTHON_3_7,
code: Code.fromAsset(`${lambdaPath}/pull-request`),
handler: 'pull_request.lambda_handler',
role: lambdaRole,
});
const codeBuildResultFunction = new Function(
this,
'CodeBuildResultFunction',
{
runtime: Runtime.PYTHON_3_7,
code: Code.asset(`${lambdaPath}/code-build-result`),
handler: 'code_build_result.lambda_handler',
role: lambdaRole,
},
);
const pullRequestProject = new Project(this, 'PullRequestProject', {
),
environment,
},
);
const topic = new Topic(scope, 'SlackApprovalTopic');
topic.grantPublish(options.role);
topic.addSubscription(new LambdaSubscription(approvalRequester));
const approvalHandler = new Function(
scope,
'SlackApprovalHandlerFunction',
{
runtime: Runtime.NODEJS_10_X,
handler: 'lib/approval-handler.handler',
code: Code.fromAsset(
path.join(__dirname, '..', 'lambda', 'bundle.zip'),
),
environment,
},
);
const api = new RestApi(scope, 'SlackApprovalApi');
api.root.addProxy({
defaultIntegration: new LambdaIntegration(approvalHandler),
});
approvalHandler.addToRolePolicy(
new PolicyStatement({
actions: ['codepipeline:PutApprovalResult'],
resources: [
`${stage.pipeline.pipelineArn}/${stage.stageName}/${this.props.actionName}`,
public constructor(
scope: Construct,
id: string,
props: StripeWebhookProps,
) {
super(scope, id);
const handler = new SingletonFunction(this, 'CustomResourceHandler', {
uuid: 'e9db3870-d793-4cd2-96a9-efe2e318ebbc',
runtime: Runtime.NODEJS_10_X,
code: Code.fromAsset(
path.join(__dirname, '..', 'lambda', 'bundle.zip'),
),
handler: 'lib/stripe-webhook.handler',
lambdaPurpose: 'Custom::StripeWebhook',
timeout: Duration.minutes(15),
});
new CustomResource(this, 'CustomResource', {
provider: CustomResourceProvider.lambda(handler),
resourceType: 'Custom::StripeWebhook',
properties: {
...props,
},
});
}
}