<commit_before>require 'stax/aws/alb'

module Stax
  module Alb
    def self.included(thor)
      thor.desc(:alb, 'ALB subcommands')
      thor.subcommand(:alb, Cmd::Alb)
    end
  end

        no_commands do
          def stack_albs
            Cfn.resources_by_type(stack_name, 'AWS::ElasticLoadBalancingV2::LoadBalancer')
          end
        end
  module Cmd
    class Alb < SubCommand

      COLORS = {
        healthy:     :green,
        unhealthy:   :red,
        unavailable: :red,
      }

      no_commands do
        def stack_albs
          Aws::Cfn.resources_by_type(my.stack_name, 'AWS::ElasticLoadBalancingV2::LoadBalancer')
        end
      end

      desc 'dns', 'ALB DNS names'
      def dns
        puts Aws::Alb.describe(stack_albs.map(&:physical_resource_id)).map(&:dns_name)
      end

      desc 'status', 'ALB instance status'
      def status
        stack_albs.each do |alb|
          Aws::Alb.target_groups(alb.physical_resource_id).each do |t|
            debug("ALB status for #{alb.logical_resource_id} #{t.protocol}:#{t.port} #{t.target_group_name}")
            print_table Aws::Alb.target_health(t.target_group_arn).map { |h|
              [h.target.id, h.target.port, color(h.target_health.state, COLORS), h.target_health.reason, h.target_health.description]
            }
          end
        end
      end

    end
  end
end<commit_msg>this moved down the same file<commit_after>require 'stax/aws/alb'

module Stax
  module Alb
    def self.included(thor)
      thor.desc(:alb, 'ALB subcommands')
      thor.subcommand(:alb, Cmd::Alb)
    end
  end

  module Cmd
    class Alb < SubCommand

      COLORS = {
        healthy:     :green,
        unhealthy:   :red,
        unavailable: :red,
      }

      no_commands do
        def stack_albs
          Aws::Cfn.resources_by_type(my.stack_name, 'AWS::ElasticLoadBalancingV2::LoadBalancer')
        end
      end

      desc 'dns', 'ALB DNS names'
      def dns
        puts Aws::Alb.describe(stack_albs.map(&:physical_resource_id)).map(&:dns_name)
      end

      desc 'status', 'ALB instance status'
      def status
        stack_albs.each do |alb|
          Aws::Alb.target_groups(alb.physical_resource_id).each do |t|
            debug("ALB status for #{alb.logical_resource_id} #{t.protocol}:#{t.port} #{t.target_group_name}")
            print_table Aws::Alb.target_health(t.target_group_arn).map { |h|
              [h.target.id, h.target.port, color(h.target_health.state, COLORS), h.target_health.reason, h.target_health.description]
            }
          end
        end
      end

    end
  end
end
{'fraction_non_alphanumeric': 0.1098732232039954, 'fraction_numerical': 0.001152516327314637, 'mean_word_length': 2.2590738423028784, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3179711', 'n_tokens_mistral': 912, 'n_tokens_neox': 887, 'n_words': 170}