Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
} else { // Derive statements from AWS SDK calls
for (const call of [props.onCreate, props.onUpdate, props.onDelete]) {
if (call) {
provider.addToRolePolicy(new iam.PolicyStatement({
actions: [awsSdkToIamAction(call.service, call.action)],
resources: ['*']
}));
}
}
}
const create = props.onCreate || props.onUpdate;
this.customResource = new CustomResource(this, 'Resource', {
resourceType: 'Custom::AWS',
provider: CustomResourceProvider.lambda(provider),
properties: {
create: create && encodeBooleans(create),
update: props.onUpdate && encodeBooleans(props.onUpdate),
delete: props.onDelete && encodeBooleans(props.onDelete)
}
});
}
constructor(scope: Construct, id: string, props: HelmChartProps) {
super(scope, id);
const stack = Stack.of(this);
// we maintain a single manifest custom resource handler for each cluster
const handler = this.getOrCreateHelmChartHandler(props.cluster);
if (!handler) {
throw new Error(`Cannot define a Helm chart on a cluster with kubectl disabled`);
}
new CustomResource(this, 'Resource', {
provider: CustomResourceProvider.lambda(handler),
resourceType: HelmChart.RESOURCE_TYPE,
properties: {
Release: props.release || this.node.uniqueId.slice(-63).toLowerCase(), // Helm has a 63 character limit for the name
Chart: props.chart,
Version: props.version,
Values: (props.values ? stack.toJsonString(props.values) : undefined),
Namespace: props.namespace || 'default',
Repository: props.repository
}
});
}
) {
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,
},
});
}
}
),
handler: 'lib/github-webhook.handler',
lambdaPurpose: 'Custom::GithubWebhook',
timeout: Duration.minutes(15),
});
const {
githubApiToken,
githubRepoUrl,
payloadUrl,
events,
logLevel,
} = props;
new CustomResource(this, 'CustomResource', {
provider: CustomResourceProvider.lambda(handler),
resourceType: 'Custom::GithubWebhook',
properties: {
GithubApiToken: githubApiToken,
GithubRepoUrl: githubRepoUrl,
PayloadUrl: payloadUrl,
Events: events,
LogLevel: logLevel,
},
});
}
}
) {
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,
},
});
}
}