improved cdk
parent
cc8cc0e8d3
commit
964c6c69c6
|
|
@ -81,6 +81,7 @@ export class GetExecuteApi {
|
|||
const newRole = new aws_iam.Role(this.scope, `${this.baseId}-role`, {
|
||||
assumedBy: new aws_iam.ServicePrincipal('lambda.amazonaws.com'),
|
||||
});
|
||||
|
||||
newRole.addToPolicy(new aws_iam.PolicyStatement({
|
||||
effect: Effect.ALLOW,
|
||||
actions: [
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ export class GetPrepareApi {
|
|||
const newRole = new aws_iam.Role(this.scope, `${this.baseId}-role`, {
|
||||
assumedBy: new aws_iam.ServicePrincipal('lambda.amazonaws.com'),
|
||||
});
|
||||
|
||||
newRole.addToPolicy(new aws_iam.PolicyStatement({
|
||||
effect: Effect.ALLOW,
|
||||
actions: [
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ export class GetSyncMsgApi {
|
|||
const newRole = new aws_iam.Role(this.scope, `${this.baseId}-role`, {
|
||||
assumedBy: new aws_iam.ServicePrincipal('lambda.amazonaws.com'),
|
||||
});
|
||||
|
||||
newRole.addToPolicy(new aws_iam.PolicyStatement({
|
||||
effect: Effect.ALLOW,
|
||||
actions: [
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ export class PrepareApi {
|
|||
const newRole = new aws_iam.Role(this.scope, `${this.baseId}-role`, {
|
||||
assumedBy: new aws_iam.ServicePrincipal('lambda.amazonaws.com'),
|
||||
});
|
||||
|
||||
newRole.addToPolicy(new aws_iam.PolicyStatement({
|
||||
effect: Effect.ALLOW,
|
||||
actions: [
|
||||
|
|
@ -148,6 +149,7 @@ export class PrepareApi {
|
|||
proxy: true,
|
||||
},
|
||||
);
|
||||
|
||||
this.router.addMethod(this.httpMethod, lambdaIntegration, <MethodOptions>{
|
||||
apiKeyRequired: true,
|
||||
requestValidator: this.requestValidator,
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ export class QueryExecuteApi {
|
|||
const newRole = new aws_iam.Role(this.scope, `${this.baseId}-role`, {
|
||||
assumedBy: new aws_iam.ServicePrincipal('lambda.amazonaws.com'),
|
||||
});
|
||||
|
||||
newRole.addToPolicy(new aws_iam.PolicyStatement({
|
||||
effect: Effect.ALLOW,
|
||||
actions: [
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ export class SyncMsgApi {
|
|||
const newRole = new aws_iam.Role(this.scope, `${this.baseId}-role`, {
|
||||
assumedBy: new aws_iam.ServicePrincipal('lambda.amazonaws.com'),
|
||||
});
|
||||
|
||||
newRole.addToPolicy(new aws_iam.PolicyStatement({
|
||||
effect: Effect.ALLOW,
|
||||
actions: [
|
||||
|
|
@ -120,6 +121,7 @@ export class SyncMsgApi {
|
|||
],
|
||||
resources: ['*'],
|
||||
}));
|
||||
|
||||
return newRole;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ export class CreateDatasetApi {
|
|||
const newRole = new aws_iam.Role(this.scope, `${this.baseId}-role`, {
|
||||
assumedBy: new aws_iam.ServicePrincipal('lambda.amazonaws.com'),
|
||||
});
|
||||
|
||||
newRole.addToPolicy(new aws_iam.PolicyStatement({
|
||||
effect: Effect.ALLOW,
|
||||
actions: [
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ export class UpdateDatasetApi {
|
|||
const newRole = new aws_iam.Role(this.scope, `${this.baseId}-update-role`, {
|
||||
assumedBy: new aws_iam.ServicePrincipal('lambda.amazonaws.com'),
|
||||
});
|
||||
|
||||
newRole.addToPolicy(new aws_iam.PolicyStatement({
|
||||
effect: Effect.ALLOW,
|
||||
actions: [
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ export class ListEndpointsApi {
|
|||
const newRole = new aws_iam.Role(this.scope, `${this.baseId}-role`, {
|
||||
assumedBy: new aws_iam.ServicePrincipal('lambda.amazonaws.com'),
|
||||
});
|
||||
|
||||
newRole.addToPolicy(new aws_iam.PolicyStatement({
|
||||
effect: Effect.ALLOW,
|
||||
actions: [
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ export class ListInferencesApi {
|
|||
const newRole = new aws_iam.Role(this.scope, `${this.baseId}-role`, {
|
||||
assumedBy: new aws_iam.ServicePrincipal('lambda.amazonaws.com'),
|
||||
});
|
||||
|
||||
newRole.addToPolicy(new aws_iam.PolicyStatement({
|
||||
effect: Effect.ALLOW,
|
||||
actions: [
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ export class CreateRoleApi {
|
|||
],
|
||||
resources: ['*'],
|
||||
}));
|
||||
|
||||
return newRole;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -144,7 +144,6 @@ export class DeleteRolesApi {
|
|||
layers: [this.layer],
|
||||
});
|
||||
|
||||
|
||||
const lambdaIntegration = new LambdaIntegration(
|
||||
lambdaFunction,
|
||||
{
|
||||
|
|
@ -152,7 +151,6 @@ export class DeleteRolesApi {
|
|||
},
|
||||
);
|
||||
|
||||
|
||||
this.router.addMethod(
|
||||
this.httpMethod,
|
||||
lambdaIntegration,
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ export class ListRolesApi {
|
|||
const newRole = new aws_iam.Role(this.scope, `${this.baseId}-role`, {
|
||||
assumedBy: new aws_iam.ServicePrincipal('lambda.amazonaws.com'),
|
||||
});
|
||||
|
||||
newRole.addToPolicy(new aws_iam.PolicyStatement({
|
||||
effect: Effect.ALLOW,
|
||||
actions: [
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@ export class PingApi {
|
|||
layers: [this.layer],
|
||||
});
|
||||
|
||||
|
||||
const lambdaIntegration = new LambdaIntegration(
|
||||
lambdaFunction,
|
||||
{
|
||||
|
|
@ -80,7 +79,6 @@ export class PingApi {
|
|||
},
|
||||
);
|
||||
|
||||
|
||||
this.router.addMethod(
|
||||
this.httpMethod,
|
||||
lambdaIntegration,
|
||||
|
|
|
|||
|
|
@ -115,7 +115,6 @@ export class DeleteTrainingJobsApi {
|
|||
layers: [this.layer],
|
||||
});
|
||||
|
||||
|
||||
const lambdaIntegration = new LambdaIntegration(
|
||||
lambdaFunction,
|
||||
{ proxy: true },
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ export class CreateUserApi {
|
|||
const newRole = new aws_iam.Role(this.scope, `${this.baseId}-role`, {
|
||||
assumedBy: new aws_iam.ServicePrincipal('lambda.amazonaws.com'),
|
||||
});
|
||||
|
||||
newRole.addToPolicy(new aws_iam.PolicyStatement({
|
||||
effect: Effect.ALLOW,
|
||||
actions: [
|
||||
|
|
@ -86,6 +87,7 @@ export class CreateUserApi {
|
|||
],
|
||||
resources: ['*'],
|
||||
}));
|
||||
|
||||
return newRole;
|
||||
}
|
||||
|
||||
|
|
@ -156,7 +158,6 @@ export class CreateUserApi {
|
|||
layers: [this.layer],
|
||||
});
|
||||
|
||||
|
||||
const lambdaIntegration = new aws_apigateway.LambdaIntegration(
|
||||
lambdaFunction,
|
||||
{
|
||||
|
|
|
|||
|
|
@ -182,7 +182,6 @@ export class Inference {
|
|||
handler.addToRolePolicy(ddbStatement);
|
||||
handler.addToRolePolicy(snsStatement);
|
||||
|
||||
|
||||
// Add the SNS topic as an event source for the Lambda function
|
||||
handler.addEventSource(
|
||||
new eventSources.SnsEventSource(props.inferenceResultTopic),
|
||||
|
|
|
|||
Loading…
Reference in New Issue