Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public initTemplate(): Template {
return {
Parameters: this.makeParams(),
Resources: {
[ResourceConstants.RESOURCES.APIKeyLogicalID]: this.makeAppSyncApiKey()
},
Outputs: {
[ResourceConstants.OUTPUTS.GraphQLAPIApiKeyOutput]: this.makeApiKeyOutput()
},
Conditions: {
[ResourceConstants.CONDITIONS.ShouldCreateAPIKey]:
Fn.And([
Fn.Not(Fn.Equals(Fn.Ref(ResourceConstants.PARAMETERS.APIKeyExpirationEpoch), -1)),
Fn.Equals(Fn.Ref(ResourceConstants.PARAMETERS.AuthCognitoUserPoolId), ResourceConstants.NONE)
]),
[ResourceConstants.CONDITIONS.APIKeyExpirationEpochIsPositive]:
Fn.And([
Fn.Not(Fn.Equals(Fn.Ref(ResourceConstants.PARAMETERS.APIKeyExpirationEpoch), -1)),
Fn.Not(Fn.Equals(Fn.Ref(ResourceConstants.PARAMETERS.APIKeyExpirationEpoch), 0))
]),
}
}
}
public initTemplate(): Template {
return {
Parameters: this.makeParams(),
Resources: {
[ResourceConstants.RESOURCES.APIKeyLogicalID]: this.makeAppSyncApiKey()
},
Outputs: {
[ResourceConstants.OUTPUTS.GraphQLAPIApiKeyOutput]: this.makeApiKeyOutput()
},
Conditions: {
[ResourceConstants.CONDITIONS.ShouldCreateAPIKey]:
Fn.And([
Fn.Not(Fn.Equals(Fn.Ref(ResourceConstants.PARAMETERS.APIKeyExpirationEpoch), -1)),
Fn.Equals(Fn.Ref(ResourceConstants.PARAMETERS.AuthCognitoUserPoolId), ResourceConstants.NONE)
]),
[ResourceConstants.CONDITIONS.APIKeyExpirationEpochIsPositive]:
Fn.And([
Fn.Not(Fn.Equals(Fn.Ref(ResourceConstants.PARAMETERS.APIKeyExpirationEpoch), -1)),
Fn.Not(Fn.Equals(Fn.Ref(ResourceConstants.PARAMETERS.APIKeyExpirationEpoch), 0))
]),
}
}
}
public initTemplate(apiKeyConfig: Transformer.ApiKeyConfig): Template {
return {
Parameters: this.makeParams(),
Resources: {
[ResourceConstants.RESOURCES.APIKeyLogicalID]: this.makeAppSyncApiKey(apiKeyConfig),
},
Outputs: {
[ResourceConstants.OUTPUTS.GraphQLAPIApiKeyOutput]: this.makeApiKeyOutput(),
},
Conditions: {
[ResourceConstants.CONDITIONS.ShouldCreateAPIKey]: Fn.Equals(Fn.Ref(ResourceConstants.PARAMETERS.CreateAPIKey), 1),
[ResourceConstants.CONDITIONS.APIKeyExpirationEpochIsPositive]: Fn.And([
Fn.Not(Fn.Equals(Fn.Ref(ResourceConstants.PARAMETERS.APIKeyExpirationEpoch), -1)),
Fn.Not(Fn.Equals(Fn.Ref(ResourceConstants.PARAMETERS.APIKeyExpirationEpoch), 0)),
]),
},
};
}
public initTemplate(): Template {
return {
Parameters: this.makeParams(),
Resources: {
[ResourceConstants.RESOURCES.GraphQLAPILogicalID]: this.makeAppSyncAPI(),
},
Outputs: {
[ResourceConstants.OUTPUTS.GraphQLAPIIdOutput]: this.makeAPIIDOutput(),
[ResourceConstants.OUTPUTS.GraphQLAPIEndpointOutput]: this.makeAPIEndpointOutput(),
},
Conditions: {
[ResourceConstants.CONDITIONS.ShouldUsePayPerRequestBilling]: Fn.Equals(
Fn.Ref(ResourceConstants.PARAMETERS.DynamoDBBillingMode),
'PAY_PER_REQUEST'
),
[ResourceConstants.CONDITIONS.ShouldUsePointInTimeRecovery]: Fn.Equals(
Fn.Ref(ResourceConstants.PARAMETERS.DynamoDBEnablePointInTimeRecovery),
'true'
),
[ResourceConstants.CONDITIONS.ShouldUseServerSideEncryption]: Fn.Equals(
Fn.Ref(ResourceConstants.PARAMETERS.DynamoDBEnableServerSideEncryption),
'true'
),
},
};
}
public makeEnvironmentConditions() {
return {
[ResourceConstants.CONDITIONS.HasEnvironmentParameter]:
Fn.Not(Fn.Equals(Fn.Ref(ResourceConstants.PARAMETERS.Env), ResourceConstants.NONE))
}
}
public makeEnvironmentConditions() {
return {
[ResourceConstants.CONDITIONS.HasEnvironmentParameter]: Fn.Not(
Fn.Equals(Fn.Ref(ResourceConstants.PARAMETERS.Env), ResourceConstants.NONE)
),
};
}
Resources: {
[ResourceConstants.RESOURCES.APIKeyLogicalID]: this.makeAppSyncApiKey()
},
Outputs: {
[ResourceConstants.OUTPUTS.GraphQLAPIApiKeyOutput]: this.makeApiKeyOutput()
},
Conditions: {
[ResourceConstants.CONDITIONS.ShouldCreateAPIKey]:
Fn.And([
Fn.Not(Fn.Equals(Fn.Ref(ResourceConstants.PARAMETERS.APIKeyExpirationEpoch), -1)),
Fn.Equals(Fn.Ref(ResourceConstants.PARAMETERS.AuthCognitoUserPoolId), ResourceConstants.NONE)
]),
[ResourceConstants.CONDITIONS.APIKeyExpirationEpochIsPositive]:
Fn.And([
Fn.Not(Fn.Equals(Fn.Ref(ResourceConstants.PARAMETERS.APIKeyExpirationEpoch), -1)),
Fn.Not(Fn.Equals(Fn.Ref(ResourceConstants.PARAMETERS.APIKeyExpirationEpoch), 0))
]),
}
}
}
return {
Parameters: this.makeParams(),
Resources: {
[ResourceConstants.RESOURCES.GraphQLAPILogicalID]: this.makeAppSyncAPI(),
},
Outputs: {
[ResourceConstants.OUTPUTS.GraphQLAPIIdOutput]: this.makeAPIIDOutput(),
[ResourceConstants.OUTPUTS.GraphQLAPIEndpointOutput]: this.makeAPIEndpointOutput(),
},
Conditions: {
[ResourceConstants.CONDITIONS.ShouldUsePayPerRequestBilling]: Fn.Equals(
Fn.Ref(ResourceConstants.PARAMETERS.DynamoDBBillingMode),
'PAY_PER_REQUEST'
),
[ResourceConstants.CONDITIONS.ShouldUsePointInTimeRecovery]: Fn.Equals(
Fn.Ref(ResourceConstants.PARAMETERS.DynamoDBEnablePointInTimeRecovery),
'true'
),
[ResourceConstants.CONDITIONS.ShouldUseServerSideEncryption]: Fn.Equals(
Fn.Ref(ResourceConstants.PARAMETERS.DynamoDBEnableServerSideEncryption),
'true'
),
},
};
}
public initTemplate(apiKeyConfig: Transformer.ApiKeyConfig): Template {
return {
Parameters: this.makeParams(),
Resources: {
[ResourceConstants.RESOURCES.APIKeyLogicalID]: this.makeAppSyncApiKey(apiKeyConfig),
},
Outputs: {
[ResourceConstants.OUTPUTS.GraphQLAPIApiKeyOutput]: this.makeApiKeyOutput(),
},
Conditions: {
[ResourceConstants.CONDITIONS.ShouldCreateAPIKey]: Fn.Equals(Fn.Ref(ResourceConstants.PARAMETERS.CreateAPIKey), 1),
[ResourceConstants.CONDITIONS.APIKeyExpirationEpochIsPositive]: Fn.And([
Fn.Not(Fn.Equals(Fn.Ref(ResourceConstants.PARAMETERS.APIKeyExpirationEpoch), -1)),
Fn.Not(Fn.Equals(Fn.Ref(ResourceConstants.PARAMETERS.APIKeyExpirationEpoch), 0)),
]),
},
};
}
public initTemplate(apiKeyConfig: Transformer.ApiKeyConfig): Template {
return {
Parameters: this.makeParams(),
Resources: {
[ResourceConstants.RESOURCES.APIKeyLogicalID]: this.makeAppSyncApiKey(apiKeyConfig),
},
Outputs: {
[ResourceConstants.OUTPUTS.GraphQLAPIApiKeyOutput]: this.makeApiKeyOutput(),
},
Conditions: {
[ResourceConstants.CONDITIONS.ShouldCreateAPIKey]: Fn.Equals(Fn.Ref(ResourceConstants.PARAMETERS.CreateAPIKey), 1),
[ResourceConstants.CONDITIONS.APIKeyExpirationEpochIsPositive]: Fn.And([
Fn.Not(Fn.Equals(Fn.Ref(ResourceConstants.PARAMETERS.APIKeyExpirationEpoch), -1)),
Fn.Not(Fn.Equals(Fn.Ref(ResourceConstants.PARAMETERS.APIKeyExpirationEpoch), 0)),
]),
},
};
}