Class: ECSHelper::ClusterHelper
- Inherits:
-
Object
- Object
- ECSHelper::ClusterHelper
- Defined in:
- lib/ecs_helper/cluster_helper.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#clusters ⇒ Object
Returns the value of attribute clusters.
-
#current_cluster ⇒ Object
Returns the value of attribute current_cluster.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#helper ⇒ Object
Returns the value of attribute helper.
-
#options ⇒ Object
Returns the value of attribute options.
-
#project ⇒ Object
Returns the value of attribute project.
Instance Method Summary collapse
- #from_env ⇒ Object
- #from_options ⇒ Object
-
#initialize(helper) ⇒ ClusterHelper
constructor
A new instance of ClusterHelper.
- #only_one ⇒ Object
Constructor Details
#initialize(helper) ⇒ ClusterHelper
Returns a new instance of ClusterHelper.
5 6 7 |
# File 'lib/ecs_helper/cluster_helper.rb', line 5 def initialize(helper) @helper = helper end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
4 5 6 |
# File 'lib/ecs_helper/cluster_helper.rb', line 4 def client @client end |
#clusters ⇒ Object
Returns the value of attribute clusters.
4 5 6 |
# File 'lib/ecs_helper/cluster_helper.rb', line 4 def clusters @clusters end |
#current_cluster ⇒ Object
Returns the value of attribute current_cluster.
4 5 6 |
# File 'lib/ecs_helper/cluster_helper.rb', line 4 def current_cluster @current_cluster end |
#environment ⇒ Object
Returns the value of attribute environment.
4 5 6 |
# File 'lib/ecs_helper/cluster_helper.rb', line 4 def environment @environment end |
#helper ⇒ Object
Returns the value of attribute helper.
4 5 6 |
# File 'lib/ecs_helper/cluster_helper.rb', line 4 def helper @helper end |
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/ecs_helper/cluster_helper.rb', line 4 def @options end |
#project ⇒ Object
Returns the value of attribute project.
4 5 6 |
# File 'lib/ecs_helper/cluster_helper.rb', line 4 def project @project end |
Instance Method Details
#from_env ⇒ Object
24 25 26 |
# 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 ⇒ Object
17 18 19 20 21 22 |
# File 'lib/ecs_helper/cluster_helper.rb', line 17 def value = helper.[: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 ⇒ Object
28 29 30 |
# File 'lib/ecs_helper/cluster_helper.rb', line 28 def only_one return clusters[0] if clusters.length == 1 end |