Class: EcsDeployer::Service::Client
- Inherits:
-
Object
- Object
- EcsDeployer::Service::Client
- Defined in:
- lib/ecs_deployer/service/client.rb
Constant Summary collapse
- LOG_SEPARATOR =
'-' * 96
Instance Attribute Summary collapse
-
#polling_interval ⇒ Object
Returns the value of attribute polling_interval.
-
#wait_timeout ⇒ Object
Returns the value of attribute wait_timeout.
Instance Method Summary collapse
- #exist?(service) ⇒ Bool
- #initialize(cluster, logger, aws_options = {}) ⇒ EcsDeployer::Service::Client constructor
- #update(service, task_definition = nil, wait = true) ⇒ Aws::ECS::Types::Service
Constructor Details
#initialize(cluster, logger, aws_options = {}) ⇒ EcsDeployer::Service::Client
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ecs_deployer/service/client.rb', line 14 def initialize(cluster, logger, = {}) @cluster = cluster @logger = logger @ecs = Aws::ECS::Client.new() @task = EcsDeployer::Task::Client.new() @wait_timeout = 900 @polling_interval = 20 end |
Instance Attribute Details
#polling_interval ⇒ Object
Returns the value of attribute polling_interval.
8 9 10 |
# File 'lib/ecs_deployer/service/client.rb', line 8 def polling_interval @polling_interval end |
#wait_timeout ⇒ Object
Returns the value of attribute wait_timeout.
8 9 10 |
# File 'lib/ecs_deployer/service/client.rb', line 8 def wait_timeout @wait_timeout end |
Instance Method Details
#exist?(service) ⇒ Bool
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/ecs_deployer/service/client.rb', line 42 def exist?(service) status = nil result = @ecs.describe_services( cluster: @cluster, services: [service] ) result[:services].each do |svc| next unless svc[:service_name] == service && svc[:status] == 'ACTIVE' status = svc break end status.nil? ? false : true end |
#update(service, task_definition = nil, wait = true) ⇒ Aws::ECS::Types::Service
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/ecs_deployer/service/client.rb', line 28 def update(service, task_definition = nil, wait = true) task_definition = @task.register_clone(@cluster, service) if task_definition.nil? result = @ecs.update_service( cluster: @cluster, service: service, task_definition: task_definition[:family] + ':' + task_definition[:revision].to_s ) wait_for_deploy(service, result.service.task_definition) if wait result.service end |