Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public makeResolverS3RootParams(): Template {
return {
Parameters: {
[ResourceConstants.PARAMETERS.Env]: new StringParameter({
Description: `The environment name. e.g. Dev, Test, or Production`,
Default: ResourceConstants.NONE
}),
ResolverBucket: new StringParameter({
Description: `The name of the bucket containing the resolver templates`,
}),
ResolverRootKey: new StringParameter({
Description: `The s3 key of the folder containing the resolver templates in format {Type}.{Field}.[response|request].{Timestamp}`,
}),
DeploymentTimestamp: new StringParameter({
Description: `The timestamp used to identify thie most recent version of the resolver templates in s3.`,
})
}
}
}
public makeParams() {
return {
[ResourceConstants.PARAMETERS.AppSyncApiName]: new StringParameter({
Description: 'The name of the AppSync API',
Default: 'AppSyncSimpleTransform',
}),
[ResourceConstants.PARAMETERS.APIKeyExpirationEpoch]: new NumberParameter({
Description:
'The epoch time in seconds when the API Key should expire.' +
' Setting this to 0 will default to 7 days from the deployment date.' +
' Setting this to -1 will not create an API Key.',
Default: 0,
MinValue: -1,
}),
[ResourceConstants.PARAMETERS.CreateAPIKey]: new NumberParameter({
Description:
'The boolean value to control if an API Key will be created or not.' +
' The value of the property is automatically set by the CLI.' +
' If the value is set to 0 no API Key will be created.',
public makeResolverS3RootParams(): Template {
return {
Parameters: {
[ResourceConstants.PARAMETERS.Env]: new StringParameter({
Description: `The environment name. e.g. Dev, Test, or Production`,
Default: ResourceConstants.NONE,
}),
[ResourceConstants.PARAMETERS.S3DeploymentBucket]: new StringParameter({
Description: 'The S3 bucket containing all deployment assets for the project.',
}),
[ResourceConstants.PARAMETERS.S3DeploymentRootKey]: new StringParameter({
Description: 'An S3 key relative to the S3DeploymentBucket that points to the root of the deployment directory.',
}),
},
};
}
public makeSchemaParam(): Template {
return {
Parameters: {
[this.removeDotsAndCamelcase('schema.graphql')]: new StringParameter({
Description: `The S3 location for the Schema: schema.graphql`,
})
}
}
}
export default function blankNestedTemplate(
params: { [key: string]: Parameter } = {}
): Template {
return {
AWSTemplateFormatVersion: '2010-09-09',
Description: `A nested stack generated by the GraphQL transform.`,
Metadata: {},
Parameters: {
[ResourceConstants.PARAMETERS.AppSyncApiId]: new StringParameter({
Description: `The id of the AppSync API associated with this project.`,
}),
...params
},
Resources: {},
Outputs: {}
}
}
public makeParams() {
return {
[ResourceConstants.PARAMETERS.ElasticsearchAccessIAMRoleName]: new StringParameter({
Description: 'The name of the IAM role assumed by AppSync for Elasticsearch.',
Default: 'AppSyncElasticsearchRole'
}),
[ResourceConstants.PARAMETERS.ElasticsearchStreamingLambdaHandlerName]: new StringParameter({
Description: 'The name of the lambda handler.',
Default: 'python_streaming_function.lambda_handler'
}),
[ResourceConstants.PARAMETERS.ElasticsearchStreamingLambdaRuntime]: new StringParameter({
Description: `The lambda runtime \
(https://docs.aws.amazon.com/lambda/latest/dg/API_CreateFunction.html#SSS-CreateFunction-request-Runtime)`,
Default: 'python3.6'
}),
[ResourceConstants.PARAMETERS.ElasticsearchStreamingFunctionName]: new StringParameter({
Description: 'The name of the streaming lambda function.',
Default: 'DdbToEsFn'
}),
[ResourceConstants.PARAMETERS.ElasticsearchStreamingIAMRoleName]: new StringParameter({
Description: 'The name of the streaming lambda function IAM role.',
Default: 'SearchableLambdaIAMRole'
}),
[ResourceConstants.PARAMETERS.ElasticsearchDebugStreamingLambda]: new NumberParameter({
Description: 'Enable debug logs for the Dynamo -> ES streaming lambda.',
Default: 1,
AllowedValues: [0, 1]
}),
[ResourceConstants.PARAMETERS.ElasticsearchInstanceCount]: new NumberParameter({
Description: 'The number of instances to launch into the Elasticsearch domain.',
Default: 1
}),
public makeResolverS3RootParams(): Template {
return {
Parameters: {
[ResourceConstants.PARAMETERS.Env]: new StringParameter({
Description: `The environment name. e.g. Dev, Test, or Production`,
Default: ResourceConstants.NONE
}),
ResolverBucket: new StringParameter({
Description: `The name of the bucket containing the resolver templates`,
}),
ResolverRootKey: new StringParameter({
Description: `The s3 key of the folder containing the resolver templates in format {Type}.{Field}.[response|request].{Timestamp}`,
}),
DeploymentTimestamp: new StringParameter({
Description: `The timestamp used to identify thie most recent version of the resolver templates in s3.`,
})
}
}
}
public makeResolverS3RootParams(): Template {
return {
Parameters: {
[ResourceConstants.PARAMETERS.Env]: new StringParameter({
Description: `The environment name. e.g. Dev, Test, or Production`,
Default: ResourceConstants.NONE
}),
ResolverBucket: new StringParameter({
Description: `The name of the bucket containing the resolver templates`,
}),
ResolverRootKey: new StringParameter({
Description: `The s3 key of the folder containing the resolver templates in format {Type}.{Field}.[response|request].{Timestamp}`,
}),
DeploymentTimestamp: new StringParameter({
Description: `The timestamp used to identify thie most recent version of the resolver templates in s3.`,
})
}
}
}
Default: 'AppSyncElasticsearchRole',
}),
[ResourceConstants.PARAMETERS.ElasticsearchStreamingLambdaHandlerName]: new StringParameter({
Description: 'The name of the lambda handler.',
Default: 'python_streaming_function.lambda_handler',
}),
[ResourceConstants.PARAMETERS.ElasticsearchStreamingLambdaRuntime]: new StringParameter({
Description: `The lambda runtime \
(https://docs.aws.amazon.com/lambda/latest/dg/API_CreateFunction.html#SSS-CreateFunction-request-Runtime)`,
Default: 'python3.6',
}),
[ResourceConstants.PARAMETERS.ElasticsearchStreamingFunctionName]: new StringParameter({
Description: 'The name of the streaming lambda function.',
Default: 'DdbToEsFn',
}),
[ResourceConstants.PARAMETERS.ElasticsearchStreamingIAMRoleName]: new StringParameter({
Description: 'The name of the streaming lambda function IAM role.',
Default: 'SearchableLambdaIAMRole',
}),
[ResourceConstants.PARAMETERS.ElasticsearchDebugStreamingLambda]: new NumberParameter({
Description: 'Enable debug logs for the Dynamo -> ES streaming lambda.',
Default: 1,
AllowedValues: [0, 1],
}),
[ResourceConstants.PARAMETERS.ElasticsearchInstanceCount]: new NumberParameter({
Description: 'The number of instances to launch into the Elasticsearch domain.',
Default: 1,
}),
[ResourceConstants.PARAMETERS.ElasticsearchInstanceType]: new StringParameter({
Description: 'The type of instance to launch into the Elasticsearch domain.',
Default: 't2.small.elasticsearch',
AllowedValues: [
public format(ctx: TransformerContext): DeploymentResources {
ctx.mergeConditions(this.schemaResourceUtil.makeEnvironmentConditions());
const resolversFunctionsAndSchema = this.collectResolversFunctionsAndSchema(ctx);
const defaultDependencies = [ResourceConstants.RESOURCES.GraphQLSchemaLogicalID];
if (ctx.getResource(ResourceConstants.RESOURCES.NoneDataSource)) {
defaultDependencies.push(ResourceConstants.RESOURCES.NoneDataSource);
}
const nestedStacks = splitStack({
stack: ctx.template,
stackRules: ctx.getStackMapping(),
defaultParameterValues: {
[ResourceConstants.PARAMETERS.AppSyncApiId]: Fn.GetAtt(ResourceConstants.RESOURCES.GraphQLAPILogicalID, 'ApiId'),
},
defaultParameterDefinitions: {
[ResourceConstants.PARAMETERS.AppSyncApiId]: new StringParameter({
Description: `The id of the AppSync API associated with this project.`,
}),
},
deployment: {
deploymentBucketParameterName: ResourceConstants.PARAMETERS.S3DeploymentBucket,
deploymentKeyParameterName: ResourceConstants.PARAMETERS.S3DeploymentRootKey,
},
importExportPrefix: Fn.Ref(ResourceConstants.PARAMETERS.AppSyncApiId),
defaultDependencies,
});
return {
...nestedStacks,
...resolversFunctionsAndSchema,
};
}