Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public noneDataSource() {
return new AppSync.DataSource({
ApiId: Fn.GetAtt(ResourceConstants.RESOURCES.GraphQLAPILogicalID, 'ApiId'),
Name: 'NONE',
Type: 'NONE',
});
}
datasource = (name: string, region: string): any => {
return new AppSync.DataSource({
ApiId: Fn.Ref(ResourceConstants.PARAMETERS.AppSyncApiId),
Name: FunctionResourceIDs.FunctionDataSourceID(name, region),
Type: 'AWS_LAMBDA',
ServiceRoleArn: Fn.GetAtt(FunctionResourceIDs.FunctionIAMRoleID(name, region), 'Arn'),
LambdaConfig: {
LambdaFunctionArn: lambdaArnResource(name, region),
},
}).dependsOn(FunctionResourceIDs.FunctionIAMRoleID(name, region));
};
public makeDynamoDBDataSource(tableId: string, iamRoleLogicalID: string, typeName: string, isSyncEnabled: boolean = false) {
return new AppSync.DataSource({
ApiId: Fn.GetAtt(ResourceConstants.RESOURCES.GraphQLAPILogicalID, 'ApiId'),
Name: tableId,
Type: 'AMAZON_DYNAMODB',
ServiceRoleArn: Fn.GetAtt(iamRoleLogicalID, 'Arn'),
DynamoDBConfig: {
AwsRegion: Refs.Region,
TableName: this.dynamoDBTableName(typeName),
...(isSyncEnabled && {
DeltaSyncConfig: SyncUtils.syncDataSourceConfig(),
Versioned: true,
}),
},
}).dependsOn([iamRoleLogicalID]);
}
public makeHttpDataSource(baseURL: string) {
return new AppSync.DataSource({
ApiId: Fn.GetAtt(ResourceConstants.RESOURCES.GraphQLAPILogicalID, 'ApiId'),
Name: HttpResourceIDs.HttpDataSourceID(baseURL),
Type: 'HTTP',
HttpConfig: {
Endpoint: this.replaceEnv(baseURL),
},
});
}
public noneDataSource() {
return new AppSync.DataSource({
ApiId: Fn.GetAtt(ResourceConstants.RESOURCES.GraphQLAPILogicalID, 'ApiId'),
Name: 'NONE',
Type: 'NONE'
})
}