Class ProcessedTemplate
- java.lang.Object
-
- pl.wrzasq.lambda.macro.pipeline.project.template.ProcessedTemplate
-
- All Implemented Interfaces:
pl.wrzasq.commons.aws.cloudformation.macro.TemplateDefinition
public class ProcessedTemplate extends Object implements pl.wrzasq.commons.aws.cloudformation.macro.TemplateDefinition
Contains template structure with handled resources references.
-
-
Field Summary
Fields Modifier and Type Field Description private static org.slf4j.Logger
logger
Logger.private static com.fasterxml.jackson.databind.ObjectMapper
objectMapper
Values converter.private Map<String,PipelineProjectResource>
resources
Mapping of handled resources.private Map<String,Object>
template
Template structure.
-
Constructor Summary
Constructors Constructor Description ProcessedTemplate(Map<String,Object> input)
Template initializer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private Map<String,Object>
createResource(String key, Map<String,Object> properties, String condition)
Creates our custom resource in place of virtual one.private Map<String,Object>
createResources(Map<String,Object> input)
Finds our custom resources and creates a replacements.Map<String,Object>
getTemplate()
Template structure.private Map<String,Object>
replaceDependencies(Map<String,Object> resources)
Handles DependsOn clauses.private Object
replaceDependenciesIn(Object dependsOn)
Handles DependsOn clause of single resource.private Map<String,Object>
replaceReferences(Map<String,Object> input)
Replaces references to virtual resources.private String
resolveDependency(String dependency)
Tries to resolve dependencies against lambda functions.
-
-
-
Field Detail
-
objectMapper
private static com.fasterxml.jackson.databind.ObjectMapper objectMapper
Values converter.
-
logger
private static org.slf4j.Logger logger
Logger.
-
resources
private Map<String,PipelineProjectResource> resources
Mapping of handled resources.
-
-
Method Detail
-
createResources
private Map<String,Object> createResources(Map<String,Object> input)
Finds our custom resources and creates a replacements.- Parameters:
input
- Initial template structure.- Returns:
- Template state after processing.
-
createResource
private Map<String,Object> createResource(String key, Map<String,Object> properties, String condition)
Creates our custom resource in place of virtual one.- Parameters:
key
- Resource logical ID.properties
- Resource initial properties.condition
- Resource creation condition.- Returns:
- Physical resources definitions.
-
replaceReferences
private Map<String,Object> replaceReferences(Map<String,Object> input)
Replaces references to virtual resources.- Parameters:
input
- Input template structure.- Returns:
- Template state after processing.
-
replaceDependencies
private Map<String,Object> replaceDependencies(Map<String,Object> resources)
Handles DependsOn clauses.- Parameters:
resources
- Resources section.- Returns:
- New clause value.
-
replaceDependenciesIn
private Object replaceDependenciesIn(Object dependsOn)
Handles DependsOn clause of single resource.- Parameters:
dependsOn
- Depends on clause.- Returns:
- Computed new DependsOn clause.
-
resolveDependency
private String resolveDependency(String dependency)
Tries to resolve dependencies against lambda functions.Effective dependency will be LogGroup, to ensure no Lambda execution happens before log group creation.
- Parameters:
dependency
- Source dependency ID.- Returns:
- Resolved dependency ID.
-
-