Class: ECSHelper::ServiceHelper
- Inherits:
-
Object
- Object
- ECSHelper::ServiceHelper
- Defined in:
- lib/ecs_helper/service_helper.rb
Instance Attribute Summary collapse
-
#cluster ⇒ Object
Returns the value of attribute cluster.
-
#current_service ⇒ Object
Returns the value of attribute current_service.
-
#helper ⇒ Object
Returns the value of attribute helper.
-
#services ⇒ Object
Returns the value of attribute services.
Instance Method Summary collapse
- #from_env ⇒ Object
- #from_options ⇒ Object
-
#initialize(helper) ⇒ ServiceHelper
constructor
A new instance of ServiceHelper.
- #only_one ⇒ Object
- #update_service(cluster, service, task_definition) ⇒ Object
Constructor Details
#initialize(helper) ⇒ ServiceHelper
Returns a new instance of ServiceHelper.
6 7 8 |
# File 'lib/ecs_helper/service_helper.rb', line 6 def initialize(helper) @helper = helper end |
Instance Attribute Details
#cluster ⇒ Object
Returns the value of attribute cluster.
4 5 6 |
# File 'lib/ecs_helper/service_helper.rb', line 4 def cluster @cluster end |
#current_service ⇒ Object
Returns the value of attribute current_service.
4 5 6 |
# File 'lib/ecs_helper/service_helper.rb', line 4 def current_service @current_service end |
#helper ⇒ Object
Returns the value of attribute helper.
4 5 6 |
# File 'lib/ecs_helper/service_helper.rb', line 4 def helper @helper end |
#services ⇒ Object
Returns the value of attribute services.
4 5 6 |
# File 'lib/ecs_helper/service_helper.rb', line 4 def services @services end |
Instance Method Details
#from_env ⇒ Object
25 26 27 |
# File 'lib/ecs_helper/service_helper.rb', line 25 def from_env services.find {|s| s.include?(helper.application) && s.include?(helper.environment)} end |
#from_options ⇒ Object
18 19 20 21 22 23 |
# File 'lib/ecs_helper/service_helper.rb', line 18 def value = helper.[:service] return nil unless value return value if services.include?(value) raise(StandardError.new("Service specified in cli not exists, services you have: #{services}")) unless services.find {|r| r == value} end |
#only_one ⇒ Object
29 30 31 |
# File 'lib/ecs_helper/service_helper.rb', line 29 def only_one return services[0] if services.length == 1 end |
#update_service(cluster, service, task_definition) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/ecs_helper/service_helper.rb', line 33 def update_service(cluster, service, task_definition) helper.client.update_service({ cluster: cluster, service: service, task_definition: task_definition }) end |