Class 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 Detail

      • objectMapper

        private static com.fasterxml.jackson.databind.ObjectMapper objectMapper
        Values converter.
      • logger

        private static org.slf4j.Logger logger
        Logger.
    • Constructor Detail

      • ProcessedTemplate

        public ProcessedTemplate​(Map<String,​Object> input)
        Template initializer.
        Parameters:
        input - Initial template structure.
    • 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.
      • getTemplate

        public Map<String,​Object> getTemplate()
        Template structure.
        Specified by:
        getTemplate in interface pl.wrzasq.commons.aws.cloudformation.macro.TemplateDefinition