def make_elb_json(self):
        """Render the JSON template with arguments.

        Returns:
            str: Rendered ELB template.
        """
        env = self.env
        region = self.region
        elb_settings = self.properties['elb']
        LOG.debug('Block ELB Settings:\n%s', pformat(elb_settings))

        health_settings = elb_settings['health']
        elb_subnet_purpose = elb_settings.get('subnet_purpose', 'internal')

        region_subnets = get_subnets(target='elb', purpose=elb_subnet_purpose, env=env, region=region)
        region_subnets.pop("subnet_ids", None)

        # CAVEAT: Setting the ELB to public, you must use a public subnet,
        #         otherwise AWS complains about missing IGW on subnet.

        if elb_subnet_purpose == 'internal':
            is_internal = 'true'
        else:
            is_internal = 'false'

        target = elb_settings.get('target', 'HTTP:80/health')
        health = splay_health(target)

        listeners = format_listeners(elb_settings=elb_settings, env=self.env, region=region)

        idle_timeout = elb_settings.get('idle_timeout', None)
        access_log = elb_settings.get('access_log', {})
        connection_draining_timeout = elb_settings.get('connection_draining_timeout', None)

        security_groups = DEFAULT_ELB_SECURITYGROUPS[env]
        security_groups.append(self.app)
        security_groups.extend(self.properties['security_group']['elb_extras'])
        security_groups = remove_duplicate_sg(security_groups)

        template_kwargs = {
            'access_log': json.dumps(access_log),
            'app_name': self.app,
            'availability_zones': json.dumps(region_subnets),
            'connection_draining_timeout': json.dumps(connection_draining_timeout),
            'env': env,
            'hc_string': target,
            'health_interval': health_settings['interval'],
            'health_path': health.path,
            'health_port': health.port,
            'health_protocol': health.proto,
            'health_timeout': health_settings['timeout'],
            'healthy_threshold': health_settings['threshold'],
            'idle_timeout': json.dumps(idle_timeout),
            'isInternal': is_internal,
            'listeners': json.dumps(listeners),
            'region_zones': json.dumps(region_subnets[region]),
            'region': region,
            'security_groups': json.dumps(security_groups),
            'subnet_type': elb_subnet_purpose,
            'unhealthy_threshold': health_settings['unhealthy_threshold'],
            'vpc_id': get_vpc_id(env, region),
        }

        rendered_template = get_template(template_file='infrastructure/elb_data.json.j2', **template_kwargs)

        return rendered_template
def make_elb_json ( self ) : env = self . env region = self . region elb_settings = self . properties [ 'elb' ] LOG . debug ( 'Block ELB Settings:\n%s' , pformat ( elb_settings ) ) health_settings = elb_settings [ 'health' ] elb_subnet_purpose = elb_settings . get ( 'subnet_purpose' , 'internal' ) region_subnets = get_subnets ( target = 'elb' , purpose = elb_subnet_purpose , env = env , region = region ) region_subnets . pop ( "subnet_ids" , None ) if elb_subnet_purpose == 'internal' : is_internal = 'true' else : is_internal = 'false' target = elb_settings . get ( 'target' , 'HTTP:80/health' ) health = splay_health ( target ) listeners = format_listeners ( elb_settings = elb_settings , env = self . env , region = region ) idle_timeout = elb_settings . get ( 'idle_timeout' , None ) access_log = elb_settings . get ( 'access_log' , { } ) connection_draining_timeout = elb_settings . get ( 'connection_draining_timeout' , None ) security_groups = DEFAULT_ELB_SECURITYGROUPS [ env ] security_groups . append ( self . app ) security_groups . extend ( self . properties [ 'security_group' ] [ 'elb_extras' ] ) security_groups = remove_duplicate_sg ( security_groups ) template_kwargs = { 'access_log' : json . dumps ( access_log ) , 'app_name' : self . app , 'availability_zones' : json . dumps ( region_subnets ) , 'connection_draining_timeout' : json . dumps ( connection_draining_timeout ) , 'env' : env , 'hc_string' : target , 'health_interval' : health_settings [ 'interval' ] , 'health_path' : health . path , 'health_port' : health . port , 'health_protocol' : health . proto , 'health_timeout' : health_settings [ 'timeout' ] , 'healthy_threshold' : health_settings [ 'threshold' ] , 'idle_timeout' : json . dumps ( idle_timeout ) , 'isInternal' : is_internal , 'listeners' : json . dumps ( listeners ) , 'region_zones' : json . dumps ( region_subnets [ region ] ) , 'region' : region , 'security_groups' : json . dumps ( security_groups ) , 'subnet_type' : elb_subnet_purpose , 'unhealthy_threshold' : health_settings [ 'unhealthy_threshold' ] , 'vpc_id' : get_vpc_id ( env , region ) , } rendered_template = get_template ( template_file = 'infrastructure/elb_data.json.j2' , ** template_kwargs ) return rendered_template
Render the JSON template with arguments.

        Returns:
            str: Rendered ELB template.