<commit_before>from security_monkey.cloudaux_watcher import CloudAuxWatcher
from cloudaux.aws.elb import describe_load_balancers
from cloudaux.orchestration.aws.elb import get_load_balancer


class ELB(CloudAuxWatcher):
    index = 'elb'
    i_am_singular = 'ELB'
    i_am_plural = 'ELBs'
    honor_ephemerals = False
    ephemeral_paths = list()
    service_name = 'elb'

    def get_name_from_list_output(self, item):
        return item['LoadBalancerName']

    def list_method(self, **kwargs):
        return describe_load_balancers(**kwargs)

    def get_method(self, item, **kwargs):
        return get_load_balancer(item, **kwargs)<commit_msg>ELB Watcher now respects SECURITYGROUP_INSTANCE_DETAIL config value.<commit_after>from security_monkey.cloudaux_watcher import CloudAuxWatcher
from cloudaux.aws.elb import describe_load_balancers
from cloudaux.orchestration.aws.elb import get_load_balancer
from security_monkey import app


class ELB(CloudAuxWatcher):
    index = 'elb'
    i_am_singular = 'ELB'
    i_am_plural = 'ELBs'
    honor_ephemerals = False
    ephemeral_paths = list()
    service_name = 'elb'
    detail = app.config.get('SECURITYGROUP_INSTANCE_DETAIL', 'FULL')

    def get_name_from_list_output(self, item):
        return item['LoadBalancerName']

    def list_method(self, **kwargs):
        return describe_load_balancers(**kwargs)

    def get_method(self, item, **kwargs):
        result = get_load_balancer(item, **kwargs)
        if self.detail == 'NONE' or self.detail == None:
            result.pop('Instances', None)
        elif self.detail == 'SUMMARY':
            result['Instances'] = '{len} Instance(s)'.format(len=len(result.get('Instances', [])))
        return result
{'fraction_non_alphanumeric': 0.10133954571927781, 'fraction_numerical': 0.0, 'mean_word_length': 4.113095238095238, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3844553', 'n_tokens_mistral': 576, 'n_tokens_neox': 570, 'n_words': 114}