Example #1
0
    def transform(self):
        """Transform logic"""
        LOGGER.debug('Transform templates if needed')

        matches = []
        transform_type = self.cfn.template.get('Transform')

        # Don't call transformation if Transform is not specified to prevent
        # useless execution of the transformation.
        # Currently locked in to SAM specific
        if transform_type == 'AWS::Serverless-2016-10-31':
            transform = Transform(self.filename, self.cfn.template, self.cfn.regions[0])
            matches = transform.transform_template()

        return matches
Example #2
0
 def transform(self):
     """Transform logic"""
     LOGGER.debug('Transform templates if needed')
     sam_transform = 'AWS::Serverless-2016-10-31'
     matches = []
     transform_declaration = self.cfn.template.get('Transform', [])
     transform_type = transform_declaration if isinstance(
         transform_declaration, list) else [transform_declaration]
     # Don't call transformation if Transform is not specified to prevent
     # useless execution of the transformation.
     # Currently locked in to SAM specific
     if sam_transform not in transform_type:
         return matches
     # Save the Globals section so its available for rule processing
     self.cfn.transform_pre['Globals'] = self.cfn.template.get('Globals', {})
     transform = Transform(self.filename, self.cfn.template, self.cfn.regions[0])
     matches = transform.transform_template()
     self.cfn.template = transform.template()
     return matches
Example #3
0
    def transform(self):
        """Transform logic"""
        LOGGER.debug('Transform templates if needed')

        matches = []
        transform_type = self.cfn.template.get('Transform')

        # Don't call transformation if Transform is not specified to prevent
        # useless execution of the transformation.
        # Currently locked in to SAM specific
        if transform_type == 'AWS::Serverless-2016-10-31':
            # Save the Globals section so its available for rule processing
            self.cfn.transform_globals = self.cfn.template.get('Globals', {})
            transform = Transform(self.filename, self.cfn.template,
                                  self.cfn.regions[0])
            matches = transform.transform_template()
            self.cfn.template = transform.template()

        return matches