<commit_before>require 'fog/core/model'
module Fog
  module AWS
    class ELB

      class LoadBalancer < Fog::Model

        identity  :id,                    :aliases => 'LoadBalancerName'
        attribute :availability_zones,    :aliases => 'AvailabilityZones'
        attribute :created_at,            :aliases => 'CreatedTime'
        attribute :dns_name,              :aliases => 'DNSName'
        attribute :health_check,          :aliases => 'HealthCheck'
        attribute :instances,             :aliases => 'Instances'
        attribute :source_group,          :aliases => 'SourceSecurityGroup'

        def initialize(attributes={})
          attributes[:availability_zones] ||= attributes['AvailabilityZones'] || %w(us-east-1a us-east-1b us-east-1c us-east-1d)
          attributes['ListenerDescriptions'] ||= [{
            'Listener' => {'LoadBalancerPort' => 80, 'InstancePort' => 80, 'Protocol' => 'HTTP'},
            'PolicyNames' => []
          }]
          attributes['Policies'] ||= {'AppCookieStickinessPolicies' => [], 'LBCookieStickinessPolicies' => []}
          super
        end

        def register_instances(instances)
          requires :id
          data = connection.register_instances_with_load_balancer(instances, id).body['RegisterInstancesWithLoadBalancerResult']<commit_msg>[AWS|ELB] offload Listener defaults to the Listener model<commit_after>require 'fog/core/model'
module Fog
  module AWS
    class ELB

      class LoadBalancer < Fog::Model

        identity  :id,                    :aliases => 'LoadBalancerName'
        attribute :availability_zones,    :aliases => 'AvailabilityZones'
        attribute :created_at,            :aliases => 'CreatedTime'
        attribute :dns_name,              :aliases => 'DNSName'
        attribute :health_check,          :aliases => 'HealthCheck'
        attribute :instances,             :aliases => 'Instances'
        attribute :source_group,          :aliases => 'SourceSecurityGroup'

        def initialize(attributes={})
          attributes[:availability_zones] ||= attributes['AvailabilityZones'] || %w(us-east-1a us-east-1b us-east-1c us-east-1d)
          unless attributes['ListenerDescriptions']
            new_listener = Fog::AWS::ELB::Listener.new
            attributes['ListenerDescriptions'] = [{
              'Listener' => new_listener.to_params,
              'PolicyNames' => new_listener.policy_names
            }]
          end
          attributes['Policies'] ||= {'AppCookieStickinessPolicies' => [], 'LBCookieStickinessPolicies' => []}
          super
        end

        def register_instances(instances)
          requires :id
          data = connection.register_instances_with_load_balancer(instances, id).body['RegisterInstancesWithLoadBalancerResult']
{'fraction_non_alphanumeric': 0.1149135446685879, 'fraction_numerical': 0.004322766570605188, 'mean_word_length': 2.5107458912768648, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 28, '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': '961769', 'n_tokens_mistral': 779, 'n_tokens_neox': 759, 'n_words': 143}