Class: Ufo::Apps::Service

Inherits:
Object
  • Object
show all
Extended by:
Memoist
Defined in:
lib/ufo/apps/service.rb

Instance Method Summary collapse

Constructor Details

#initialize(service, options) ⇒ Service

Returns a new instance of Service.



5
6
7
8
# File 'lib/ufo/apps/service.rb', line 5

def initialize(service, options)
  @service = service
  @options = options
end

Instance Method Details

#cfn_mapObject



22
23
24
# File 'lib/ufo/apps/service.rb', line 22

def cfn_map
  @cfn_map ||= CfnMap.new(@options).map
end

#dnsObject



45
46
47
48
49
# File 'lib/ufo/apps/service.rb', line 45

def dns
  return 'dns' if ENV['TEST']
  elb = info.load_balancer(@service)
  elb.dns_name if elb
end

#infoObject



51
52
53
# File 'lib/ufo/apps/service.rb', line 51

def info
  Ufo::Info.new(@service)
end

#launch_typeObject



18
19
20
# File 'lib/ufo/apps/service.rb', line 18

def launch_type
  @service["launch_type"]
end

#nameObject



31
32
33
34
35
36
37
38
39
# File 'lib/ufo/apps/service.rb', line 31

def name
  actual_service_name = @service["service_name"]
  pretty_name = cfn_map[actual_service_name]
  if pretty_name
    "#{actual_service_name} (#{pretty_name})"
  else
    actual_service_name
  end
end

#runningObject



41
42
43
# File 'lib/ufo/apps/service.rb', line 41

def running
  @service["running_count"]
end

#task_definitionObject



14
15
16
# File 'lib/ufo/apps/service.rb', line 14

def task_definition
  @service["task_definition"].split('/').last
end

#to_aObject



10
11
12
# File 'lib/ufo/apps/service.rb', line 10

def to_a
  [name, task_definition, running, launch_type, ufo?]
end

#ufo?Boolean

Returns:

  • (Boolean)


26
27
28
29
# File 'lib/ufo/apps/service.rb', line 26

def ufo?
  yes = !!cfn_map[@service["service_name"]]
  yes ? "yes" : "no"
end