Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public makeStreamingLambdaIAMRole() {
return new IAM.Role({
RoleName: this.joinWithEnv('-', [
Fn.Ref(ResourceConstants.PARAMETERS.ElasticsearchStreamingIAMRoleName),
Fn.GetAtt(ResourceConstants.RESOURCES.GraphQLAPILogicalID, 'ApiId'),
]),
AssumeRolePolicyDocument: {
Version: '2012-10-17',
Statement: [
{
Effect: 'Allow',
Principal: {
Service: 'lambda.amazonaws.com',
},
Action: 'sts:AssumeRole',
},
],
},
public makeStreamingLambdaIAMRole() {
return new IAM.Role({
RoleName: this.joinWithEnv("-", [
Fn.Ref(ResourceConstants.PARAMETERS.ElasticsearchStreamingIAMRoleName),
Fn.GetAtt(ResourceConstants.RESOURCES.GraphQLAPILogicalID, 'ApiId'),
]),
AssumeRolePolicyDocument: {
Version: "2012-10-17",
Statement: [
{
Effect: "Allow",
Principal: {
Service: "lambda.amazonaws.com"
},
Action: "sts:AssumeRole"
}
]
},
public makeElasticsearchAccessIAMRole() {
return new IAM.Role({
RoleName: this.joinWithEnv("-", [
Fn.Ref(ResourceConstants.PARAMETERS.ElasticsearchAccessIAMRoleName),
Fn.GetAtt(ResourceConstants.RESOURCES.GraphQLAPILogicalID, 'ApiId')
]),
AssumeRolePolicyDocument: {
Version: '2012-10-17',
Statement: [
{
Effect: 'Allow',
Principal: {
Service: 'appsync.amazonaws.com'
},
Action: 'sts:AssumeRole'
}
]
},
private makeIAMDataSourceRole() {
return new IAM.Role({
RoleName: Fn.Join('-', ['role', Fn.Ref(ResourceConstants.PARAMETERS.AppSyncApiId), Fn.Ref(ResourceConstants.PARAMETERS.Env)]),
AssumeRolePolicyDocument: {
Version: '2012-10-17',
Statement: [
{
Effect: 'Allow',
Principal: {
Service: 'appsync.amazonaws.com',
},
Action: 'sts:AssumeRole',
},
],
},
Policies: [
new IAM.Role.Policy({
public makeElasticsearchAccessIAMRole() {
return new IAM.Role({
RoleName: this.joinWithEnv('-', [
Fn.Ref(ResourceConstants.PARAMETERS.ElasticsearchAccessIAMRoleName),
Fn.GetAtt(ResourceConstants.RESOURCES.GraphQLAPILogicalID, 'ApiId'),
]),
AssumeRolePolicyDocument: {
Version: '2012-10-17',
Statement: [
{
Effect: 'Allow',
Principal: {
Service: 'appsync.amazonaws.com',
},
Action: 'sts:AssumeRole',
},
],
},