class ECSHelper::ClusterHelper

Attributes

client[RW]
clusters[RW]
current_cluster[RW]
environment[RW]
helper[RW]
options[RW]
project[RW]

Public Class Methods

new(helper) click to toggle source
# File lib/ecs_helper/cluster_helper.rb, line 5
def initialize(helper)
  @helper = helper
end

Public Instance Methods

from_env() click to toggle source
# File lib/ecs_helper/cluster_helper.rb, line 24
def from_env
  clusters.find {|c| c.include?(helper.project) && c.include?(helper.environment)}
end
from_options() click to toggle source
# File lib/ecs_helper/cluster_helper.rb, line 17
def from_options
  value = helper.options[:cluster]
  return nil unless value
  return value if clusters.include?(value)
  raise(StandardError.new("Cluster specified in cli not exists, clusters you have: #{clusters}")) unless clusters.find {|r| r == value}
end
only_one() click to toggle source
# File lib/ecs_helper/cluster_helper.rb, line 28
def only_one
  return clusters[0] if clusters.length == 1
end