Sha256: 6d1e7dc37163247862d58a2bad58ee2b2e42bfd18da2c348490774a9a82963f1
Contents?: true
Size: 1018 Bytes
Versions: 5
Compression:
Stored size: 1018 Bytes
Contents
# frozen_string_literal: true module AwsCftTools module Runbooks ## # Hosts - report on EC2 instances # # @example # % aws-cli hosts # list all known EC2 instances # % aws-cli hosts -e QA # list all known EC2 instances in the QA environment # % aws-cli hosts -r Bastion -e QA # list all known Bastion hosts in the QA environment # class Hosts < Runbook::Report ### # @return [Array<OpenStruct>] # def items client.instances.sort_by(&method(:sort_key)) end ### # @return [Array<String>] # def columns %w[public_ip private_ip] + environment_column + role_column + ['instance'] end private def sort_key(host) [host.environment, host.role, host.ip].compact end def environment_column options[:environment] ? [] : ['environment'] end def role_column options[:role] ? [] : ['role'] end end end end
Version data entries
5 entries across 5 versions & 1 rubygems